Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ehcache, Redis and Gemfire which Cache for which Scenario?

Grails provides three extended cache plugins:

  1. Ehcache

  2. Redis Cache

  3. Gemfire Cache

What are the advantages and disadvantages of these caches and in which scenario should I use which cache?

like image 212
confile Avatar asked Aug 22 '13 21:08

confile


People also ask

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.

Is Ehcache in-memory cache?

In this article, we will introduce Ehcache, a widely used, open-source Java-based cache. It features memory and disk stores, listeners, cache loaders, RESTful and SOAP APIs and other very useful features.

What is Redis cache used for?

Caching. Redis is a great choice for implementing a highly available in-memory cache to decrease data access latency, increase throughput, and ease the load off your relational or NoSQL database and application.

Is GemFire a cache?

High-performance application cache, a database, and much more. VMware GemFire is a distributed, in-memory, key-value store that performs read and write operations at blazingly fast speeds.


1 Answers

Redis is a shared data structure, while ehCache is an in-memory storage of serialized data objects. Gemfire is similarly to ehCache, but they try to solve the data synchronization issues between multiple machines. So an in-memory data system used in the distributed environments.

So it depends. Is your software scaled to multiple machines then ehCache is not be the best option, since you will have to worry about cache invalidation on all machines (and to have the same version of data on every machine).

Do you need more than just caching? Will software written in multiple languages use your cache? Then use Redis. Redis is not just a cache, it can be viewed as a key value storage (database - like) where the data is stored on a machine in the RAM memory, but it can also be flushed to disk (to keep it persistent).

In Redis you can query data, you can create great counters, send batch transactions. check here for more info: http://redis.io/topics/introduction

Between all 3, I would personally pick redis (for large distributed software) and ehCache when I just need a simple, quick in memory cache. These 2 have great communities behind them and you will find answers to whatever issues you encounter.

like image 90
mkbrv Avatar answered Oct 01 '22 19:10

mkbrv