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

2022-01-18 00:00:00 grid load-balancing java gridgain

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

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.

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

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

知道其他人吗?

推荐答案

有几种:

  • 兵马俑 (开源,基于 Mozilla 公共许可证);
  • Oracle Coherence(原 Tangosol Coherence;商业;基于 JSR 107,从未正式采用);
  • GigaSpaces(商业;基于 JavaSpaces API,Jini 的一部分);
  • GridGain,你提到的(开源:LGPL);
  • memcached 与 Java 客户端库(开源:BSD 许可;
  • EHCache(开源:Apache 软件许可;
  • OSCache(开源:修改后的 Apache 许可证;和
  • 无疑还有其他几个.
  • Terracotta (open source, based on Mozilla Public License);
  • Oracle Coherence (formerly Tangosol Coherence; commercial; based on JSR 107, which was never adopted officially);
  • GigaSpaces (commercial; based on JavaSpaces API, part of Jini);
  • GridGain, which you mentioned (open source: LGPL);
  • memcached with a Java client library (open source: BSD License;
  • EHCache (open source: Apache Software License;
  • OSCache (open source: modified Apache License; and
  • no doubt several others.

现在我还没有使用所有这些,但我已经使用或研究了其中的大部分.

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

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

GridGain and GigaSpaces are more centred around grid computing than 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.

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

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.

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

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.

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

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.

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

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.

相关文章