Showing posts with label terracotta. Show all posts
Showing posts with label terracotta. Show all posts

Tuesday, January 22, 2008

memcached, the best choice for distributed hibernate second cache

After painful evaluation of the terracotta, finally I decided to drop it.

The terracotta concept is good and attracting. But when I am testing, it causes us a lot of trouble for class loading.

After many workarounds, terracotta server is up and running. But the cpu is pretty high under load and GC time killed the application since responding time is the key for the web application.

Finally, I decide to write the memcached provider for the hibernate, use use memcached as the second level cache for hibernate. The client API I used is http://www.whalin.com/memcached/. I have not optimized the code yet, but the cpu and memory usage is much lower than terracotta server.

I also eveluate other java cache solutions, all of them have their advantages. But still none of them can bypass the limitation of heap size and will cause big GC time.

Compared to those java cache solution, memcached's get/set operation is slower, but comparing to the database operation, the difference of the get/set operations between memcached and ehcache can be ignored.

If there are more and more data to cache on the road, hibernate + memcached as second level cache is the way to go.

I am also doing research on the way to use ehcache as local and short term cache and use the memcached as the long term and distributed cache.

I will post more information about my memcached cache provider for hibernate.

Wednesday, October 10, 2007

which cache for the hibernate? memcached, EHCache or terracotta?

I am in the process to evaluate which cache is better for my purpose. I will post my research result here.

Greg Luck has done a rough test for memcached and EHCache.

http://gregluck.com/blog/archives/2007/05/comparing_memca.html

The data shows EHCache is much faster than memcached. I think the testing is not fair, since the memcached is for distributed cache and test for EHCache has tested the local cache only.