如何为Java应用程序创建简单的分布式Map? [英] How to create a simple distributed Map for Java application?

查看:277
本文介绍了如何为Java应用程序创建简单的分布式Map?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个Map来在不同机器上运行的两个Java Web应用程序实例之间共享信息。读取和写入此映射需要非常快,并且不必是事务性的,即如果一个实例有一段时间的陈旧数据就可以了。

I am looking for a Map to share information between two instances of a Java web application running on separate machines. Reads and writes to this map need to be very fast and don't have to be transactional i.e. its ok if one instance has stale data for a while.

任何建议?

我需要跟踪用户上次在应用程序中执行某些操作的情况,因此如果此信息已过期,则非常糟糕。速度和易用性很重要。我不希望写入Map以影响响应时间。

I need to keep track of the last time a user did something in the application, so its not terribly bad if this information is out of date. Speed and ease of use are important. I don't want writes to the Map to impact response times.

推荐答案

我会尝试Hazelcast,JGroups或Ehcache。所有都支持分布式映射。

I would try Hazelcast, JGroups or Ehcache. All support a distributed map.

编辑:另一种选择是使用RMI top在一个或另一个JVM中运行的服务。这样就不需要额外的库了。

Another option is to use RMI top a service running in one or the other JVM. This avoids the need for an additional library.

这篇关于如何为Java应用程序创建简单的分布式Map?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆