Java分布式对象具有局部性吗?
我正在评估应用程序服务器的各种 Java 对象分发库(Terracotta、JCS、JBoss、Hazelcast ...),但我无法理解它们在各个轴上的行为。
我对分布式对象的要求并不多——它们归结为一对一和一对多消息传递。还有更多,但对于其余的,我们只使用 JDBC,并且我假设我可以使用任何可用的库在其前面放置一个缓存。
我想要一个能够分发对象并展示局部性属性的系统——换句话说,获取对象的服务器倾向于保留它,而不会与其他节点进行过多的通信。 Hazelcast 看起来很简单(并且点对点很好),但似乎要求对象均匀分布在所有节点上。
我想要一种持久化对象的方法,最好是透明的。我计划使用 EC2,因此我可以选择临时、免费、有限的本地存储(磁盘)和永久、非免费、无限的存储 (S3)。不用担心 OutOfMemoryErrors 就好了。
我喜欢兵马俑的简单性和“魔力”,但它却让我感到害怕。此外,为了真正扩展,您必须花费 $$$$,否则您将与单个集线器进行通信。
我很便宜,我想要的东西不仅是免费的,而且是成熟的并且拥有大量的用户群。
感谢您的任何意见。
I am evaluating various Java object distribution libraries (Terracotta, JCS, JBoss, Hazelcast ...) for an application server and I'm having trouble understanding their behavior on various axes.
My requirements for distributed objects are not many -- they boil down to one-to-one and one-to-many messaging. There's more, but for the rest we just use JDBC and I assume I can plop a cache in front of this using any of the available libraries.
I would like a system that distributes objects and exhibits locality properties -- in other words, a server that grabs an object tends to hold onto it without excess communication to other nodes. Hazelcast looks simple (and peer-to-peer is nice) but seems to require objects are distributed evenly across all nodes.
I'd like a way to persist objects, preferably transparently. I plan on using EC2, so I have the option of temporary, free, limited local storage (the disk) and permanent, non-free, unlimited storage (S3). It'd be great not to worry about OutOfMemoryErrors.
I like the simplicity and "magic" of Terracotta but it scares the beejeezus out of me. Also in order to truly scale you have to spend $$$$, otherwise you're communicating with a single hub.
I'm cheap and I want something not only free but mature and with a large userbase.
Thanks for any input.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Terracotta 似乎非常适合您的情况。
开始玩弄它吧。我打赌你会喜欢它。为了缓解您对性能的担忧,只需运行消息传递的吞吐量测试即可。这不会花费您一个下午的时间。
我必须承认我已经一年没有使用 Terracotta 并且我不认识你建议的其他人。
Terracotta seems like a perfect fit for your situation.
Just start playing around with it. I bet you'll love it. To ease your performance fears, simply run a through put test for message passing. This shouldn't take much more than an afternoon of your time.
I have to admit that I haven't used Terracotta for a year and that I don't know the others you suggested.
兵马俑确实符合要求。我理解您的反对意见,但这是我的评论:
1)Terracotta 确实表现出局部性 - 与您提到的系统相比,它可能是最好的系统。对象仅在请求时才被引入本地 JVM。读取或写入的锁定是使用租赁机制执行的。这意味着如果您在系统中表现出完美的局部性,那么您将产生非常小的网络开销。
2) Terracotta 提供开箱即用的磁盘持久性 - 在 OSS 版本中(您不必支付 $$$$)
3) 为什么它让您如此害怕?只需使用 EHCache 作为缓存,或使用 Hibernate 2nd Level Plugin。它的设置和使用非常简单。
4) 是的,Terracotta FX 需要您付费(对于横向扩展服务器)。不过,我建议,如果您有一个大部分被阅读并表现出真实局部性的系统,那么我认为您在获得所需的规模方面不会有问题。对于 Terracotta 3.2,使用 8 个应用程序服务器和一台 Terracotta 服务器时,Hibernate 二级缓存的性能为 100,000 次操作/秒,读/写率为 100/0;使用相同配置,读/写率为 95/5,性能为 12,000 次操作/秒。
(我刚刚在湾区 SDForum 上做了关于这些数字的演讲,所以我碰巧手头有它们)
Terracotta does fit the bill. I understand your objections, but here's my comments:
1) Terracotta does exhibit locality - and is probably the best system at it compared to those you mentioned. Objects are only brought in to a local JVM where requested. Locking for reads or writes is performed using a leasing mechanism. This means if you exhibit perfect locality in your system then you will incur very little network overhead.
2) Terracotta provides disk persistence out of the box - in the OSS version (you don't have to pay $$$$)
3) Why does it scare you so much? Just use EHCache as a cache, or the Hibernate 2nd Level Plugin. It's incredibly easy to setup and use.
4) Yes, Terracotta FX requires you to pay (for scale-out servers). However I would suggest that if you have a system that is mostly read and exhibits true locality then I don't think you'll have a problem getting the scale you are looking for. With Terracotta 3.2 the performance of the Hibernate 2nd Level Cache is 100,000 ops/s using 8 application servers and one Terracotta server at 100/0 read/write ratio and 12,000 ops/s using the same config at 95/5 read/write ratio.
(I just did a talk for the Bay Area SDForum on these numbers so I happen to have them handy)
是的 Hazelcast 将在整个集群中分发您的对象。但是,如果您想降低通信成本,可以启用近缓存。
http://www.hazelcast.com/documentation.jsp#MapNearCache
Yes Hazelcast will distribute your objects across the cluster. However you can enable near cache if you want to reduce the communication cost.
http://www.hazelcast.com/documentation.jsp#MapNearCache
顺便说一句,目前尚不清楚您在寻找什么(消息传递与集群/分布式对象不同)。
如果您正在寻找 Java 消息传递,我建议您看看 RabbitMQ(它是基于 Erlang 的,但这并不重要)。
Btw, it's not clear what you are looking for (messaging is not the same as clustering/distributed objects).
If you are looking for messaging in Java I recommend you have a look at RabbitMQ (it's Erlang based but that doesn't matter).