In-Memory Chaching (ElastiCache, DAX)

ElastiCache is a managed in-memory data store supporting the Redis or Memcached engines. ElastiCache is used for two common use cases:

  • Offloading database reads by caching responses, improving application speed and reducing costs
  • Storing user session state, allowing for stateless compute instances (used for fault-tolerant architectures)

Generally, ElastiCache is used with key value databases or to store simple session data, but it can be used with SQL database engines.

  • Managed in-memory data store and cache
  • Memcached or Redis engines
  • Typically used to offload database reads to improve web application performance

 

Node Type

  • Families affect CPU
    • General Purpose (T2, M4, M5)
    • Memory Optimized (R4, R5)
  • Sizes affect memory and network

 

Monitoring – CloudWatch metrics

  • CPU Utilization
    • When threshold is exceeded
      • Increase the node family
      • Add more read replicas (Redis) or nodes (Memcached)
  • Evictions
    • Older items are removed to free up memory for new items
    • Frequent evictions will decrease performance ,
      • Increase the node size (memory)
  • CurrConnections
    • The application may not be releasing connections
  • Swap Usage
    • Affects performance if increased
    • Should be close to 0
    • Increase node size

 

DynamoDB Accelerator (DAX) is an in-memory cache designed specifically for DynamoDB. Results delivered from DAX are available in microseconds rather than in the single-digit milliseconds available from DynamoDB.

DAX maintains two distinct caches:

  • Item cache
  • Query cache.

The item cache is populated with results from GetItem and BatchGetItem and has a five-minute default TTL.

The query cache stores results of Query and Scan operations and caches based on the parameters specified.