最好的 Java 缓存框架

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3022331/
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-13 15:39:55  来源:igfitidea点击:

Best cache framework for Java

javacaching

提问by Rodrigo Asensio

I need to implement a cache solution in java for a cluster of 9 servers with web applications. I saw apache JCS, seems old, do you know another open source solution?

我需要在 Java 中为具有 Web 应用程序的 9 个服务器集群实现缓存解决方案。看了apache JCS,好像老了,你知道另一个开源解决方案吗?

采纳答案by Alexey Ogarkov

You can try to look at Terracottaframework Or you can use distributed Ehcache

你可以试试看Terracotta框架 或者你可以使用分布式Ehcache

回答by Aravind Yarram

回答by user1697575

I think in order to use distributed EhCache you need a commercial Terracotta license.

我认为为了使用分布式 EhCache,您需要一个商业 Terracotta 许可证。

Another alternative would be memCached (see: http://memcached.org) which does not require commercial license and its widely used by high traffic web sites like YouTube, LiveJournal, Flikr, Wikipedia, etc...

另一种选择是 memCached(参见:http: //memcached.org),它不需要商业许可,并且被 YouTube、LiveJournal、Flikr、维基百科等高流量网站广泛使用......

Good article on memcached:

关于 memcached 的好文章:

Use Memcached for Java enterprise performance, Part 1: Architecture and setuphttp://www.javaworld.com/javaworld/jw-04-2012/120418-memcached-for-java-enterprise-performance.html

使用 Memcached 提高 Java 企业性能,第 1 部分:架构和设置http://www.javaworld.com/javaworld/jw-04-2012/120418-memcached-for-java-enterprise-performance.html

Use Memcached for Java enterprise performance, Part 2: Database-driven web appshttp://www.javaworld.com/javaworld/jw-05-2012/120515-memcached-for-java-enterprise-performance-2.html

将 Memcached 用于 Java 企业性能,第 2 部分:数据库驱动的 Web 应用程序http://www.javaworld.com/javaworld/jw-05-2012/120515-memcached-for-java-enterprise-performance-2.html

回答by Ehcache User

  1. Correction, you do not need a commercial license to do a distributed cache with Terracotta's Ehcache. Ehcache lets you do just a few nodes in a cluster, one of them being the TSA if I remember correctly.

  2. Memcache is purely a caching layer that isn't persistent to disk, Terracotta's Ehcache is.

  1. 更正,您不需要商业许可即可使用 Terracotta 的 Ehcache 进行分布式缓存。Ehcache 允许你在集群中只做几个节点,如果我没记错的话,其中一个是 TSA。

  2. Memcache 纯粹是一个缓存层,不是持久到磁盘的,Terracotta 的 Ehcache 是。

As for when it comes to Java, Terracotta's Ehcache is off the jave heap, this lets you have as big of a cache as you want depending on the amount of memory your server has. They're working with single JVMs that have 4TB heap sizes w/ no garbage collection at all. Memcache doesn't have this off heap feature at all.

至于 Java,Terracotta 的 Ehcache 不在 jave 堆中,这让您可以根据服务器拥有的内存量拥有尽可能大的缓存。他们正在使用具有 4TB 堆大小的单个 JVM,而根本没有垃圾收集。Memcache 根本没有这个堆外特性。

Downside, if your app isn't Java, Terracotta will be a lot of work- Terracotta is primarily Java based.

不利的一面是,如果您的应用程序不是 Java,Terracotta 将需要大量工作——Terracotta 主要是基于 Java 的。

I just met these guys at JavaOne this last week, so I got a lot of good information from them.

上周我刚刚在 JavaOne 遇到了这些人,所以我从他们那里得到了很多很好的信息。