Pragmatic Programmer Issues

Choosing the right cache

Comments: 3

My friend Piotr asks me about cache. Truly I can’t suggest him any cache. So I decided to compare cache libraries.

Nomination in alphabetical order:

Cache4j

Cache4j is very simple cache. Its have three cache algorithms LFU, LRU, FIFO. It’s fast and small. There is no English documentation (there is Russian one). There’s no JMX. Configuration is simple (algorithm, idle time, max memory, time to live). In my opinion if you search simple cache maybe WhirlyCache be better one. For enterprise this one is unusable. Last version 0.4 from 2006.03.09 says for itself.

EhCache

Once oscache losing power, ehcache is stronger. Last version is from 26 February 2007. Once again “2007 February 26”. There is JMX support for statistic and for configuration. Great! Ehcache has many configuration options, good performance. It has also very good site documentation, works with hibernate. It’s good choice. Keep going

JCS (Java Caching System)

Ok, Jakarta project. Last distro was 5 months ago, not so bad. Version 1.2.9.2. Many configuration options, documentation is ok. This cache allows plugin. In distro we have memory, disk, lateral and remote plugin. No JMX but we have admin servlet. In my opinion we can forget about this cache mechanism now.

JBossCache

This one as Ehcache is also alive. Last version (2.0.0.ALPHA2) was released on 2007 January. Good professional support. There is perfect documentation. It is extremely configurable, it has
JMX support and there is POGO caching by annotation and AOP. In my opinion this is very good choice.

JCache

On the beginning it’s not so good. Last version 1.0-beta6 released two year ago. Let’s see performance page. Faster than hashmap, it’s amazing, but after that of course 2005 so it’s tested on java 1.4 (1.4.2_05-b04). What else, we see great milestones. For example in 1.2 there will be JMX support. Ok I think that this is enough, another dead cache system.

OSCache

This one includes jsp tag library for caching regions of web pages. As a cache it’s rather slow. No JMX, and last version 2.3.2 from 07.23.2006, that’s minus. I think opensymphony are too busy (webwork and struts integration). It’s ok, but a little bit old.

ShiftOne

Good cache system. We achieve FIFO, LRU, LFU algorithms. What is very important we have JMX with some statistics and also hibernate integration. From JMX you can get some statistics. But as many cache systems last update was three years ago, it’s not so bad because of version 2.0, but you know world are changing.

SwarmCache

The most deadly project I have ever seen. In news section we read that 1.0RC2 was released at 10.25.2003. The one interesting think is that this cache is distributed. In my opinion it is scrap, no stable release for three and half a year.

WhirlyCache

It’s very simple, fast in memory cache. It has a plugin for hibernate. It has plugin mechanism and one very interesting feature Cacheable key interface, which allows you to use as function hook on remove, store and retrieve action. Maybe it is not for enterprise but it is ok form home use. It’s nearly dead project, version 1.0.1 released on May 2006.

In my opinion for serious use we should consider JBossCache or Ehcahe. For home made simple caches I suggest you WhirlyCache. If I forget about some cache system please post comment.

Regards

Technorati Tags: ,

Categories

Comments

Sydney HooverSydney Hoover

hi
udtmlvolehlo08qh
good luck

pedropedro

I try it just for a while. It’s nice and powerful. It’s a pity that it is commercial product, but you can evaluate for 30 days. There is a community edition without clustering. I downloaded this three version and I think about write some comparison when I gain more experiences. Thanks for the post.

gevageva

Nice list. You should also look at GigaSpaces Caching Edition.