AWS ElastiCache - Memcached and Redis


Amazon ElastiCache supports the Redis and Memcached cache engines. Redis is an open-source in-memory data structure implementing a distributed, in-memory key-value database. Memcached is also a distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects to reduce the number of times an external data source must be read to get the values in to the web application.

Below are the scenarios under which we should choose the specific engine in the AWS platform.

Using Redis

The below list of features show how Redis is capable of handling more complex data structures, provide persistence and sorting etc. So the scenarios under which we should favour Redis as the platfrom in ElastiCache are described here.

  • Need to store complex data types, such as strings, hashes, lists, sets, sorted sets, and bitmaps.

  • Need to sort or rank in-memory datasets.

  • Need persistence of your key store.

  • Need to replicate your data from the primary to one or more read replicas for read intensive applications.

  • Need automatic failover if your primary node fails.

  • Need automatic failover if your primary node fails.

  • Need backup and restore capabilities.

  • Need to support multiple databases.

Using Memcached

Memcached is more suitable for simpler data structures and does not provide persistence. So the below scenarios are appropriate for Memcached use.

  • Need the simplest data model possible to store Key-Value pairs.

  • Need to run large nodes with multiple cores or threads

  • Need the ability to scale out and in, adding and removing nodes as demand on your system increases and decreases.

  • Need to cache objects, such as a database.