[AWS] Caching

The following services provide caching on AWS:

  • CloudFront
  • API Gateway
  • ElastiCache
  • DynamoDB Accelerator

DynamoDB Accelerator (DAX)

DAX is highly-available, fully-managed in-memory read cache service designed for DynamoDB.

There is no need to manage the caching logic. DAX uses a cluster architecture (one or more nodes) and can deliver results as fast as in microseconds!

  • DAX delivers up to 10x read performance improvements.
    • Mircosecond performance for millions of requests per second.
    • DAX can be used for heavy-read workloads or data with repeated read patterns.
  • Read API calls hit the DAX first before reaching the DynamoDB table.
    • DAX can reduce RCUs on the table.
  • DAX can only be used with eventually consistent reads.

DAX maintains two distinct caches.

  • Item Cache stores results from GetItem and BatchGetItem and has 5-minute default TTL.
  • Query Cache stores results from Query and Scan operations.

Do not use DAX if

  • You need strongly consistent reads
  • or You do not have extremely heavy requests.

ElastiCache

ElastiCache is a managed in-memory data store – Redis or Memcached.

  • Offloading database reads or storing user session states for the stateless compute.

Redis

  • Features
    • master/slave replication and Multi-AZ redundancy
    • more advanced data types (lists, hashes, and sets)
    • pub/sub capabilities
    • data sorting and ranking
  • Use Cases
    • data persistence (backup/restore)
    • leader dashboard using ranking

Memcached

  • Simple in-memory object caching
  • Large cache node with multi-threaded performance (horizontal scale out)
  • No persistence, No multi-AZ support

Leave a Comment