AWS ElastiCache – Overview

ElastiCache is a distributed cache environment for providing faster access to data by using cloud-based caching. Querying for data directly from databases or through remote API calls is much slower than querying the data from cache. AWS provides ElastiCache service which has high performance, scalability and cost-effectiveness. It removes the complexities associated with managing a distributed cache.

Use Cases for ElastiCache

Below are some of the use cases which leverage ElastiCache for fastness in querying in a cost-effective manner.

  • Real-time analytics − When customers do online shopping, the recommendation of products have to generated instantly when the customer is still browsing the catalogue. This needs the existing products already chosen by the customer to be stored in the cache and analysed in real time for recommending the next set of products.
  • Message Management − When the message is sent to subscribers through some channels, there is always a flux of some subscribers cancelling their subscription and some other joining the specific channel. Without caching mechanism there is a chance of messages getting missed or misplaced due to delay. So ElastiCache helps in maintain the subscription status current and accurate.
  • Leader boards − In the gaming industry there is a constant update on the points scored by the gamers and their position in the leader board. This needs continuous update and caching is very much needed here to be able to display the changing leadership positions continuously.

ElastiCache Content

Everything can not be and need not be cached. So, the various factors that influence what kind of content need to be cached are discussed below.

  • Database content − Those content which are fetched after a complex and expensive query processing are definitely a candidate for caching. It reduces latency by avoiding repetition of query processing and brings down the cost of database disk read/write.
  • Frequently accessed data − Even when there is a type of data that does not involve expensive query, it may need caching if it is more frequently accessed that other chunks of data.
  • Access Pattern − If the data changes too frequently, then it is not useful for caching. So, we need to look for the ways where the accessed data is relatively static but frequently needed by user.
  • Tolerance for Staleness − Once cached, the data starts becoming stale until it is read again. In such scenarios, if the application needing the data has low tolerance for stale data then caching does not help. For example, when you are buying a stock, the price needs to be accurate at the moment hence no caching needed. But yesterday’s closing stock price which will be frequently referred for today’s calculation is static and needs to be cached.

Components of ElastiCache

The ElastiCache provisioned by AWS has the following important components. We will see their configuration and use in the subsequent chapters.

  • Node − A node is a fixed-size chunk of secure, network-attached RAM. Each cache node has its own Domain Name Service (DNS) name and port.
  • ElastiCache for Redis Shards − It is a group of one to six related nodes. A cluster can have one to 90 shards.
  • ElastiCache for Redis Clusters − A Redis cluster is a logical grouping of one or more ElastiCache for Redis Shards. Data is partitioned across the shards in a Redis (cluster mode enabled) cluster.
  • ElastiCache for Redis Endpoints −It is a unique address your application uses to connect to an ElastiCache node or cluster.

Features of ElastiCache

The various features of ElastiCache helps us to plan for the proper configuration and cost estimation. The important features are as below.

  • ElastiCache for Redis Replication − Replication is implemented by grouping from two to six nodes in a shard. One of these nodes is the read/write primary node. All the other nodes are read-only replica nodes.
  • Regions and Availability Zones − The cache can be built and used in any locations that meet your business requirements. The AWS ElastiCache service is available in multiple AWS regions worldwide.
  • ElastiCache Parameter Groups − An ElastiCache parameter group is a named collection of engine-specific parameters that you can apply to a cluster. They are used to control memory usage, eviction policies and item sizes etc.
  • ElastiCache for Redis Security − You can control the Amazon EC2 instances that can access your cluster by using subnet groups or security groups.

Leave a Reply