Greg started off with a brief history on the progress of Ehcache over the years [I still remember those early conversations that I had with Greg about 5 years ago when I first contributed to the project]. The project was never static, in fact far from it, there has been a steady progress from the stage where it was simple-yet-powerful standalone cache to a well-implemented extensible distributed framework.
In the early stages, Greg was not too keen on building a distributed cache. Once the goal of getting out a great standalone cache was achieved, and that coupled with contributions from various people (and feature requests) the quest towards distributed cache began. This post Ehcache goes distributed on his blog explains the thought process of that time quite well.
Founded in 2003 as a fork of one of the other open source caching frameworks (Apache JCS). It progressed steadily with additions like Hibernate integration, web caching, distributed caching, Cache Server with REST and SOAP services. Terracotta acquired Ehcache in 2009.
Ehcache Configuration and Performance
Greg explained the basic configuration of Ehcache using Spring's Pet Clinic as an example -- configuring Hibernate and using Ehcache as the second-level cache. He went over configuration options and about the cache eviction algorithms.
I think the performance discussion evoked quite a bit of interest in the audience (well, who doesn't like talking about benchmarks and pretty charts! ) Arguably, Ehcache is the one of the best out there, in terms of performance. If you want to know more about the tests check out the source code yourself (requires Terracotta user account to browse that repository, registration is free).
Here are a few performance figures from the presentation, showing Ehcache's superiority in terms of performance. The speaker also demonstrated the performance figures of Hibernate read and write with Ehcache as the second-level cache (not shown below). Tests were performed in a cluster of 8 client JVMs (1.75G heap), 1 Terracotta server (6G heap) and using MySql
Get (Read) and Put (Write) performance charts below:
Ehcache in-process vs Memcached:
Ehcache in-process has to be faster than Memcached. If not for anything, the basic setup of in-process should have an upper hand over the serialization and network overhead for the Memcached setup. I'd be more interested in more apples-to-apples comparison of Ehcache server (REST-based) vs Memcached. Mentioned that to Greg and I'm sure he is on to it next ...
New Features in Ehcache 2.0
- Hibernate 3.3+ caching API: New SPI addresses some of the synchronization issues with the previous versions to better suit for the clustered environment.
- JTA: From version 2.0, Ehcache acts as an XAResource and participates in JTA transactions. It detects most common transaction managers for various popular application servers.
- Write-through and write-behind caching: Version 2.0 introduces write-through and write-behind caching. In write-through pattern -- cache acts as a facade to an underlying resource, and a write to the cache causes write to the resource behind it. In write-behind the concept is pretty much the same but the writes happen in an asynchronous fashion. Read more here.
- Bulk loading: Greg said this is one of the features that's been requested for a while now. Now 2.0 has the ability to significantly speed up bulk loading into caches using the Terracotta server array. Read more here.
All-in-all I think that was a great session, and as always, I enjoy using Ehcache and the association with the project. I also got a chance to hack some code with Greg while he was here in Philadelphia. Hope to contribute more ...