使您的应用程序启用网格/集群的 Java 最佳库是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/383920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 14:04:56  来源:igfitidea点击:

What is the best library for Java to grid/cluster-enable your application?

javagridload-balancinggridgain

提问by Sarel Botha

This is the ability to run your application on a cluster of servers with the intent to distribute the load and also provide additional redundancy.

这是在服务器集群上运行应用程序的能力,目的是分配负载并提供额外的冗余。

I've seen a presentation for GridGainand I was very impressed with it.

我看过GridGain的演示文稿,我对它印象非常深刻。

Know of any others?

知道其他人吗?

采纳答案by cletus

There are several:

有几种:

Now I haven't used all of these but I've used or investigated the majority of them.

现在我还没有使用所有这些,但我已经使用或调查了其中的大部分。

GridGain and GigaSpaces are more centred around grid computingthan caching and (imho) best suited to compute grids than data grids (see this explanation of compute vs data grids). I find GigaSpaces to be a really interesting technology and it has several licensing options, including a free version and a free full version for startups.

GridGain 和 GigaSpaces 更侧重于网格计算而不是缓存,并且(恕我直言)最适合计算网格而不是数据网格(请参阅计算与数据网格的解释)。我发现 GigaSpaces 是一项非常有趣的技术,它有多种许可选项,包括免费版和面向初创公司的免费完整版。

Coherence and Terracotta try to treat caches as Maps, which is a fairly natural abstraction. I've used Coherence a lot and it's an excellent high-performance product but not cheap. Terracotta I'm less familiar with. The documentation for Coherence I find a bit lacking at times but it really is a powerful product.

Coherence 和 Terracotta 尝试将缓存视为Maps,这是一个相当自然的抽象。我经常使用 Coherence,它是一款出色的高性能产品,但并不便宜。兵马俑我不太熟悉。我发现 Coherence 的文档有时有点缺乏​​,但它确实是一个强大的产品。

OSCache I've primarily used as a means of reducing memory usage and fragmentation in Java Web applications as it has a fairly neat JSP tag. If you've ever looked at compiled JSPs, you'll see they do a lot of String concatenations. This tag allows you to effectively cache the results of a segment of JSP code and HTML into a single String, which can hugely improve performance in some cases.

OSCache 我主要用作减少 Java Web 应用程序中的内存使用和碎片的一种方法,因为它有一个相当整洁的 JSP 标记。如果您曾经看过编译的 JSP,您会看到它们进行了大量的字符串连接。该标签允许您将一段 JSP 代码和 HTML 的结果有效地缓存到单个 String 中,这在某些情况下可以极大地提高性能。

EHCache is an easy caching solution that I've also used in Web applications. Never as a distributed cache though but it can do that. I tend to view it as a quick and dirty solution but that's perhaps my bias.

EHCache 是一种简单的缓存解决方案,我也在 Web 应用程序中使用过。虽然永远不会作为分布式缓存,但它可以做到这一点。我倾向于将其视为一种快速而肮脏的解决方案,但这可能是我的偏见。

memcached is particularly prevelent in the PHP world (and used by such sites as Facebook). It's a really light and easy solution and has the advantage that it doesn't run in the same process and you'll have arguably better interoperability options with other technology stacks, if this is important to you.

memcached 在 PHP 世界中特别流行(并被 Facebook 等网站使用)。这是一个非常轻量级和简单的解决方案,其优点是它不会在同一进程中运行,如果这对您很重要,您将拥有与其他技术堆栈更好的互操作性选项。

回答by Alex Miller

I think @cletus's summary is pretty good. I did want to mention that Terracotta provides a lot more than just a distributed cache in the form of a map. It clusters Java heap and synchronization primitives, turning a concurrent Java program into a distributed Java program. You can do caching with it (including using distributed versions of open source cache libs) or a bunch of other stuff.

我觉得@cletus 的总结很不错。我确实想提一下,Terracotta 提供的不仅仅是地图形式的分布式缓存。它集群 Java 堆和同步原语,将并发 Java 程序转换为分布式 Java 程序。您可以使用它进行缓存(包括使用开源缓存库的分布式版本)或一堆其他东西。

For work distribution, there are some extra libs written on top of Terracotta, in particular the tim-pipes (for messages) and tim-masterworker (for Master-Worker style distribution) are great abstractions on top of Terracotta. This library is on the Terracotta Forge:

对于工作分发,在 Terracotta 之上编写了一些额外的库,特别是 tim-pipes(用于消息)和 tim-masterworker(用于 Master-Worker 风格的分发)是 Terracotta 之上的很好的抽象。这个图书馆位于兵马俑锻造厂:

This recently added page may add a bit of additional info in comparison to some other potential data technologies:

与其他一些潜在的数据技术相比,这个最近添加的页面可能会添加一些额外的信息:

回答by Alex Miller

If you want to go a little lower-level, there is JGroups, which provides you with the very basics of clustering java processes.

如果您想深入一点,可以使用JGroups,它为您提供了 Java 进程集群的基础知识。

回答by Alex Miller

You may want to check out Hazelcast also. Hazelcastis an open source transactional, distributed/partitioned implementation of queue, topic, map, set, list, lock and executor service. It is super easy to work with; just add hazelcast.jar into your classpath and start coding. Almost no configuration is required.

您可能还想查看 Hazelcast。Hazelcast是队列、主题、映射、集合、列表、锁和执行器服务的开源事务性、分布式/分区实现。它非常容易使用;只需将 hazelcast.jar 添加到您的类路径中并开始编码。几乎不需要任何配置。

If you are interested in executing your Runnable, Callable tasks in a distributed fashion, then please check out Distributed Executor Service documentation at http://code.google.com/docreader/#p=hazelcast

如果您有兴趣以分布式方式执行 Runnable、Callable 任务,请查看分布式执行器服务文档,网址http://code.google.com/docreader/#p=hazelcast

Hazelcastis released under Apache license and enterprise grade support is also available.

Hazelcast是在 Apache 许可下发布的,并且还提供企业级支持。

回答by raupach

JPPFis also nice.

JPPF也不错。

回答by Brett McCann

Another you can add to the list is Appistry CloudIQ. It is a distributed computing environment. It is available as a free downloadup to 5 machines. It includes load distribution as well as automatic fail over of work in the case of a hardware failure, among other features.

您可以添加到列表中的另一个是Appistry CloudIQ。它是一个分布式计算环境。它可以作为一个免费下载多达5台机器。它包括负载分配以及在硬件故障的情况下工作的自动故障转移等功能。

回答by John Channing

For grid computing, you could also consider Ice Gridor DataSynapse GridServer. These both provide very effective mechanisms for distributing tasks and provide fail over and redundancy.

对于网格计算,您还可以考虑使用Ice GridDataSynapse GridServer。这些都为分配任务提供了非常有效的机制,并提供了故障转移和冗余。

回答by Karl

I think your question has been interpreted in different ways, you ask about a library which you can use to "cluster enable" your application.

我认为您的问题已被以不同的方式解释,您询问了一个可用于“集群启用”您的应用程序的库。

While some of the libs named above can help provide specific cluster functionality such as distributed caching, the more conventional way of enabling work load management is through the use of a J2EE container.

虽然上面提到的一些库可以帮助提供特定的集群功能,例如分布式缓存,但启用工作负载管理的更传统的方法是通过使用 J2EE 容器。

By setting up a clustered container instance this allows you to utilise HA features and work load management, clustering is almost transparent at the application level. I say almost because when writing applications that are going to be clustered you have to be careful how you manage state, for example if you implemented some sort of cache you would need to replicate the state of the cache across each machine.

通过设置集群容器实例,您可以利用 HA 功能和工作负载管理,集群在应用程序级别几乎是透明的。我这么说几乎是因为在编写将要集群的应用程序时,您必须小心管理状态的方式,例如,如果您实现了某种缓存,则需要在每台机器上复制缓存的状态。

A good starting place would be to download glassfish and try and setup a clustered glassfish instance.

一个好的起点是下载 glassfish 并尝试设置集群 glassfish 实例。

Hope that helps.

希望有帮助。

Karl

卡尔

回答by Lukas Grijander

Also check Fura

还要检查Fura

回答by Lukas Grijander

And also check ProActive

并检查ProActive