Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hazelcast vs ehcache

Question is clear as you see in the title, it would be appreciated to hear your ideas about adv./disadv. differences between them.

UPDATE: I have decided to use Hazelcast because of the advantages like distributed caching/locking mechanism as well as the extremely easy configuration while adapting it to your application.

like image 585
javatar Avatar asked Mar 09 '11 12:03

javatar


People also ask

Is Hazelcast better than Redis?

Repeatable benchmarks show that Hazelcast is many times faster. Redis is single-threaded, so it does not efficiently scale for larger loads, while Hazelcast performance scales linearly with additional resources. Hazelcast is easy to use, and it can be embedded in apps or deployed in a client-server model.

Is Ehcache good?

Ehcache is an open source, standards-based cache for boosting performance, offloading your database, and simplifying scalability. It's the most widely-used Java-based cache because it's robust, proven, and full-featured.

What is difference between Ehcache and Redis cache?

You can think Redis as a shared data structure, while Ehcache is a memory block storing serialized data objects. This is the main difference. Redis as a shared data structure means you can put some predefined data structure (such as String, List, Set etc) in one language and retrieve it in another language.

Why is Ehcache used?

Ehcache is a standards-based caching API that is used by Integration Server. Caching enables an application to fetch frequently used data from memory (or other nearby resource) rather than having to retrieve it from a database or other back-end system each time the data is needed.


3 Answers

We tried both of them for one of the largest online classifieds and e-commerce platform. We started with ehcache/terracotta(server array) cause it's well-known, backed by Terracotta and has bigger community support than hazelcast.
When we get it on production environment(distributed,beyond one node cluster) things changed, our backend architecture became really expensive so we decided to give hazelcast a chance.

Hazelcast is dead simple, it does what it says and performs really well without any configuration overhead.

Our caching layer is on top of hazelcast for more than a year, we are quite pleased with it.

like image 83
Berkay Avatar answered Oct 08 '22 09:10

Berkay


Even though Ehcache has been popular among Java systems, I find it less flexible than other caching solutions. I played around with Hazelcast and yes it did the job, it was easy to get running etc and it is newer than Ehcache. I can say that Ehcache has much more features than Hazelcast, is more mature, and has big support behind it.

There are several other good cache solutions as well, with all different properties and solutions such as good old Memcache, Membase (now CouchBase), Redis, AppFabric, even several NoSQL solutions which provides key value stores with or without persistence. They all have different characteristics in the sense they implement CAP theorem, or BASE theorem along with transactions.

You should care more about, which one have the functionality you want in your application, again, you should consider CAP theorem or BASE theorem for your application.

This test was done very recently with Cassandra on the cloud by Netflix. They reached to million writes per second with about 300 instances. Cassandra is not a memory cache but you data model is like a cache, which is consist of key value pairs. You can as well use Cassandra as a distributed memory cache.

like image 19
DarthVader Avatar answered Oct 08 '22 07:10

DarthVader


Hazelcast has been a nightmare to scale and stability is still a major issue.

The dedicated client to grid component choices are

  1. The messy version that cant survive node loss anywhere, negating the point of backups (superclient), or
  2. An incredibly slow native client option that does not allow for any type of load balancing to processing nodes in the grid.

If any host could request records from this data grid it would be a sweet design, but you are stuck with those two lackluster option to get anything out of it.

Also multiple issues with database thread pools locking up on individual members and not writing anything to the databases, causing permanent records loss is a frequent issue and we often have to take the whole thing down for hours to refresh any of the JVM's. Split brain is also still an issue, although in 1.9.6 it seems to have calmed down a little.

Rallying to move to Ehcache and improving the database layer instead of using this as a band-aid.

like image 12
james Avatar answered Oct 08 '22 08:10

james