Amazon ElastiCache

Amazon ElastiCache

Amazon ElastiCache is a web service that seamlessly sets up, runs, and scales popular open-Source compatible in-memory data stores in the cloud.or cache environment in the cloud. It provides a high-performance, scalable, and cost-effective caching solution. Customers can build data-intensive apps or boost the performance of their existing databases by retrieving data from high throughput and low latency in-memory data stores. Amazon ElastiCache is a popular choice for real-time use cases like Caching, Session Stores, Gaming, Geospatial Services, Real-Time Analytics, and Queuing.

  • Amazon ElastiCache offers fully managed Redis and Memcached for customers most demanding applications that require sub-millisecond response times. Remote Dictionary Server (Redis) is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability, whereas Memcached is in-memory key-value store service that can be used as a cache or a data store.

Radis Features

Automatic detection of and recovery from cache node failures. Redis employs a primary-replica architecture and supports asynchronous replication where data can be replicated to multiple replica servers. This provides improved read performance (as requests can be split among the servers) and faster recovery when the primary server experiences an outage.

Redis simplifies users code by enabling them to write fewer lines of code to store, access, and use data in your applications. Redis comes with native data structures and many options to manipulate and interact with users data. Over a hundred open source clients are available for Redis developers. Some of the supported languages are Java, Python, PHP, C, C++, C#, JavaScript, Node.js, Ruby, R, Go and many others.

Redis as an in-memory data store with high availability and persistence is a popular choice among application developers to store and manage session data for internet-scale applications. Redis provides the sub-millisecond latency, scale, and resiliency required to manage session data such as user profiles, credentials, session state, and user-specific personalization.

Multi-AZ with automatic failover for a failed primary cluster to a read replica, in Redis clusters that support replication. This provides improved read performance (as requests can be split among the servers) and faster recovery when the primary server experiences an outage. For persistence, Redis supports point-in-time backups.

Integration with other AWS services such as Amazon EC2, Amazon CloudWatch, AWS CloudTrail, and amazon SNS. This integration helps provide a managed in-memory caching solution that is high performance and highly secure.

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. Redis can serve frequently requested items at sub-millisecond response times, and enables you to easily scale for higher loads without growing the costlier backend.

Flexible Availability Zone placement of nodes and clusters for increased fault tolerance. Redis offers purpose-built in-memory data structures and operators to manage real-time geospatial data at scale and speed. Commands such as GEOADD, GEODIST, GEORADIUS, and GEORADIUS BY MEMBER to store, process, and analyze geospatial data in real-time make geospatial easy and fast with Redis. Customers can use Redis to add location-based features such as drive time, drive distance, and points of interest to your applications.

All Redis data resides in-memory, in contrast to databases that store data on disk or SSDs. By eliminating the need to access disks, in-memory data stores such as Redis avoid seek time delays and can access data in microseconds. Redis features versatile data structures, high availability, geospatial, Lua scripting, transactions, on-disk persistence, and cluster support making it simpler to build real-time internet scale apps.

Redis Versions

Amazon ElastiCache for Redis is a fast in-memory data store that provides sub-millisecond latency to power internet-scale real-time applications. Built on open-source Redis and compatible with the Redis APIs, ElastiCache for Redis works with your Redis clients and uses the open Redis data format to store your data. The self-managed Redis applications can work seamlessly with ElastiCache for Redis without any code changes.

  • ElastiCache for Redis combines the speed, simplicity, and versatility of open-source Redis with manageability, security, and scalability from Amazon to power the most demanding real-time applications in Gaming, Ad-Tech, E-Commerce, Healthcare, Financial Services, and IoT. Customers can choose Redis with a version of ElastiCache for the following purposes:


Region read replica clusters for ElastiCache for Redis to enable low-latency reads and disaster recovery across AWS Regions. Each global datastore is a collection of one or more clusters that replicate to one another.

  • A primary cluster accepts writes that are replicated to all clusters within the global data store, and accepts read requests.
  • A secondary cluster only accepts read requests and replicates data updates from a primary cluster. A secondary cluster needs to be in a different AWS Region than the primary cluster.
  • A global datastore can help increase the responsiveness of your application by serving low-latency, geolocal reads across AWS Regions.


A shard (API/CLI: node group) is a collection of one to six Redis nodes. A Redis (cluster mode disabled) cluster will never have more than one shard. Redis (cluster mode enabled) clusters can have from 1 to 90 shards. You can create a cluster with higher number of shards and lower number of replicas totaling up to 90 nodes per cluster. This cluster configuration can range from 90 shards and 0 replicas to 15 shards and 5 replicas, which is the maximum number of replicas allowed. The cluster’s data is partitioned across the cluster’s shards.

  • A shard (in the API and CLI, a node group) is a hierarchical arrangement of nodes, each wrapped in a cluster. Shards support replication. Within a shard, one node functions as the read/write primary node. All the other nodes in a shard function as read-only replicas of the primary node.

Redis Version 4.0.10

Redis Version 4.0.10 enables both encryption and dynamically adding or removing shards form customer Redis cluster.

Redis version 3.2.10 also allows customer’s dramatically add or remove shards from their Redis. However it doesn’t support encryption.

  • It  introduces online cluster resizing to add or remove shards from the cluster while it continues to serve incoming I/O requests. ElastiCache for Redis.

Redis 3.2.6 version enabled In-transit encryption, At-rest encryption, and HIPAA eligibility certification.

  • ElastiCache for Redis perform in-Transit Encryption (TLS), at-Rest Encryption, and HIPAA Eligibility

Redis version 3.2.4 has the functionality of Redis 2.8.x, and supports the partition of data across two to 90 node groups (clustered mode only), for geospatial indexing (clustered mode or non-clustered mode), and multiple databases.


A node is the smallest building block of an Amazon ElastiCache deployment. It is a fixed-size chunk of secure, network-attached RAM. Each node runs the engine that was chosen when the cluster or replication group was created or last modified. Each node has its own Domain Name Service (DNS) name and port. Multiple types of ElastiCache nodes are supported, each with varying amounts of associated memory and computational power.

  • Sharding, Redis (cluster mode enabled) deployments have a number of smaller nodes.
  • Redis (cluster mode disabled) deployments have fewer, larger nodes in a cluster. 


cluster is a collection of one or more cache nodes, all of which run an instance of the Redis cache engine software. When you create a cluster, you specify the engine and version that all of the nodes will use.

  • Redis clusters can contain a single node or up to six nodes inside a shard (API/CLI: node group), A single-node Redis (cluster mode disabled) cluster has no shard.
  • A multi-node Redis (cluster mode disabled) cluster has a single shard. Redis (cluster mode enabled) clusters can have up to 90 shards, with your data partitioned across the shards.
  • Every cluster need to have a cluster identifier, thai is a customer-supplied name for the cluster. This identifier specifies a particular cluster when interacting with the ElastiCache API and AWS CLI commands. The cluster identifier must be unique for that customer in an AWS Region.

Redis version 5.0

Redis version 5.0.0 is  a log data structure that allows producers to append new items in real time and also allows consumers to consume messages either in a blocking or non-blocking fashion.

  1. This models a log data structure that allows producers to append new items in real time. It also allows consumers to consume messages either in a blocking or nonblocking fashion. Streams also allow consumer groups, which represent a group of clients to cooperatively consume different portions of the same stream of messages, similar to Apache Kafka.
  2. Bug fixes to improve sorted set edge cases, accurate memory usage and more. For more information.
  3. Engine stability guarantee in special conditions, Improved Hyperloglog error handling, and enhanced handshake commands for reliable replication.
  4. It includes online configuration changes for ElastiCache for Redis of auto-failover clusters during all planned operations. You can now scale your cluster, upgrade the Redis engine version and apply patches and maintenance updates while the cluster stays online and continues serving incoming requests. It also includes bug fixes.

Global Datastore

Amazon Machine Image

Amazon Machine Image

Global Datastore enables customers to write on their ElastiCache for Redis cluster in one region and have the data available to be read from two other cross-region replica clusters, thereby enabling low-latency reads and disaster recovery across regions. Since it supports cross-region replication latency of typically under 1 second, it automatically increases the responsiveness customers applications by providing geo-local reads closer to end users.

  • Global Datastore leverages Redis’ sub-millisecond latency for local reads/writes in primary region and local reads in secondary regions.
  • Global Datastore for Redis uses encryption in-transit for cross-region traffic to keep customers data secure. Additionally, clients can also encrypt their primary and secondary clusters using encryption at-rest to keep their data secured end-to-end.
  • Customers can also easily add or remove regions from the Global Datastore, or promote a secondary region to become the primary. 


Memcached is a general-purpose distributed memory-caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. Memcached is free and open-source software, licensed under the Revised BSD license. Memcached runs on Unix-like operating systems (at least Linux and OS X) and on Microsoft Windows. It depends on the libevent library. In today’s fast paced world, the success of websites and business is greatly affected by the speed at which delivers content. Whether serving the latest news or a product catalog, or selling tickets to an event, speed is the name of the game. That is where ElastiCache for Memcached comes in to play a major role:

  • Using in-memory key-value store, ElastiCache for Memcached provides ultrafast (submillisecond latency) and inexpensive access to copies of data. Memcached Cache has multiple features to enhance reliability for critical production deployments.
  • It is an easy-to-use, high-performance, in-memory data store. It offers a mature, scalable, open-source solution for delivering sub-millisecond response times making it useful as a cache or session store. Memcached is a popular choice for powering real-time applications in Web, Mobile Apps, Gaming, Ad-Tech, and E-Commerce.

Memcached FEATUREs 

The Memcached engine supports partitioning your data across multiple nodes. Because of this, Memcached clusters scale horizontally easily. A Memcached cluster can have from 1 to 20 nodes.

  • Memcached not only  keeps its data in memory, but it is also distributed means is easy to scale out by adding new nodes, and multithreaded, for that customers can easily scale up compute capacity.

Automatic discovery of nodes within a cluster enables for automatic discovery, so that no changes need to be made to the application when add or remove body. Memcached keeps all of its data in the server’s main memory. In-memory data stores don’t have to make repeated round trips to disk. This allows them to deliver blazing fast performance with sub-millisecond average read and write times and support for millions of operations per second.

Automatic detection and recovery from cache node failures. Memcached is designed to provide the sub-millisecond latency and scale required to manage session data such as user profiles, credentials, and session state.

Integration with other AWS services such as Amazon EC2, Amazon CloudWatch, AWS CloudTrail, and Amazon SNS to provide a secure, high-performance, managed in-memory caching solution.

  • Amazon ElastiCache for Memcached can be integrated with Amazon VPC, enabling clients to isolate their cluster to the IP ranges their choice for  the nodes.

Flexible Availability Zone placement of nodes and clusters. Memcached is multithreaded, which can use multiple cores on a given node. This makes it simple to scale up compute capacity. Because Memcached is distributed, it can split data among a number of nodes, enabling customers to scale out capacity by adding new nodes to their cluster.

Customers who elect to use Memcached get the simplest model possible, they can run large nodes with multiple cores or threads, they have the ability to scale out and in, adding and removing nodes as demand on their system increases and decreases, and able to cache objects, such as a database.

Memcached versions

Memcached Version 1.4

ElastiCache for Memcached version 1.4

  • Cumulative fixes, such as ASCII multigets, CVE-2017-9951 and limit crawls for metadumper.
  • Better connection management by closing connections at the connection limit.
  • Improved item-size management for item size above 1MB.
  • Better performance and memory-overhead improvements by reducing memory requirements per-item by a few bytes.
  • Ability to dump all of the metadata for a particular slab class, a list of slab classes, or all slab classes.
  • Improved support for large items over the 1 megabyte default.
  • Ability to dynamically increase the amount of memory available to Memcached without having to restart the cluster.
  • Least recently used (LRU) management using a background process.
  • Enhanced slab rebalancing capability.
  • Performance and scalability improvement.
  • Introduced the touch command to update the expiration time of an existing item without fetching it.

Memcached version 1.5

ElastiCache for Memcached version 

  • supports the following Memcached features:
  • Automated slab rebalancing.
  • Faster hash table lookups with murmur3 algorithm.
  • Segmented LRU algorithm.
  • LRU crawler to background-reclaim memory. –enable-seccomp:
  • A compile-time option.
  •  bug fixes and cumulative updates

Memcached Implementation

Memcached Cluster

A Memcached cluster is a logical grouping of one or more ElastiCache Nodes. Data is partitioned across the nodes in a Memcached cluster.

  • Memcached supports up to 100 nodes per customer for each AWS Region with each cluster having 1–20 nodes.
  • Memcached engine database clusters made these nodes, that can be partitioned across the nodes. Customers application reads and writes to each node’s endpoint.

Memcached Endpoints

An endpoint is the unique address your application uses to connect to an ElastiCache node or cluster.

  • Each node in a Memcached cluster has its own endpoint. The cluster also has an endpoint called the configuration endpoint. If you enable Auto Discovery and connect to the configuration endpoint, your application automatically knows each node endpoint, even after adding or removing nodes from the cluster.

ElastiCache Subnet Groups

A subnet group is a collection of subnets (typically private) that you can designate for your clusters running in an Amazon Virtual Private Cloud (Amazon VPC) environment.

  • If you create a cluster in an Amazon VPC, then you must specify a cache subnet group. ElastiCache uses that cache subnet group to choose a subnet and IP addresses within that subnet to associate with your cache nodes.

ElastiCache Nodes

A node is fixed-size chunk of secure network-attached to a  RAM, which is also the smallest building block of an ElastiCache deployment. Each node runs an instance of Memcached, and a node can exist in isolation from or in some relationship to other nodes.

  • Every node within a cluster is the same instance type and runs the same cache engine. Each cache node has its own Domain Name Service (DNS) name and port.

Auto Discovery

The Memcached engine enables customers to use Auto Discovery. Auto Discovery is the ability for client programs to automatically identify all of the nodes in a cache cluster, and to initiate and maintain connections to all of these nodes.

  • The configuration endpoint DNS entry contains the CNAME entries for each of the cache node endpoints. Thus, by connecting to the configuration endpoint, the application immediately has information about all of the nodes in the cluster and can connect to all of them.

ElastiCache Parameter Groups

Cache parameter groups are an easy way to manage runtime settings for supported engine software. Parameters are used to control memory usage, eviction policies, item sizes, and more. 

  • An ElastiCache parameter group is a named collection of engine-specific parameters that you can apply to a cluster. By doing this, you make sure that all of the nodes in that cluster are configured in exactly the same way.