문제

I would like to use caching in my web application which will be scalable and distributed as well.

I have used EHCache and MemCache both in small-small web application separately.

Have googled and got mixed review about both, hence would like to get some help and strong features of each, so i can decided which framework is suitable for my web application.

Let me know if need further details.

Thanks !!

도움이 되었습니까?

해결책

EHCache is very easy to integrate with Hibernate applications (web apps that use Hibernate as a backend ORM). You can also import it as a separate artifact and do stuff in a programmatic way, like add data to a named cache with a specified expire period or number of max objects, or size.

Memcached is not that easily integrated with hibernate applications but in essence provides almost the same API for programmatic access as the EHCache.

As far as performance goes, results will also vary depending on architecture and usage of the cache.

In conclusion, when choosing a cache, if you are using in a standard way, it is just a matter of preference which cache you are going to choose. I, personally, would choose EHCache as I have considerably more experience with it.

There is a distributed cache by JBoss as well (as in cache shared by a cluster of machines) where sync is handled internally and the API is very similar to EHCache. It is called Infinispan and is also relatively easy to set up and use.

EDIT:

As a strong feature of EHCache, I would list the seamless integration as a second-level cache for Hibernate. Also, configuring a cache in a programmatic way is very easy and Java-esque.

Maybe it is also a good idea to refer you to this for a comparison of performance. Keep in mind it's ancient, so maybe is not very up to date. http://gregluck.com/blog/archives/2007/05/comparing-memcached-and-ehcache-performance/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top