Table of Contents
AWS ElastiCache
- Querying a database will always be slower and more expensive than locating a key in a key-value pair cache.
- In-memory key-value store is to provide ultra-fast latency
- Most data stores have areas of data that are frequently accessed but seldom updated.
- It is an AWS fully managed web service
- In-memory key value data store in the AWS cloud
- It improves the performance of web applications by allowing for the retrieval of information from a fast, managed, in-memory system (instead of reading from the DB itself)
- Improves response times for user transactions and queries
- Can enhance response time for read-intensive or compute-intensive workloads
- It offloads the read workload from the main DB instances (less I/O load on the DB)
- If an Elasticache node fails, it is automatically replaced by AWS Elasticache Service
- Your application connects to your cluster using endpoints. An endpoint is a node or cluster’s unique address
- A cluster can have one or more nodes included within
- A cluster is a collection of one or more nodes using the same caching engine
- A cluster can be as small as one node
- Supports two caching engines:
- Memcached
- Redis
ElastiCache – Memcached
- Memcached is an easy-to-use, high-performance, in-memory data store.
- Cache or Session store
- It offers a scalable, open-source solution for delivering sub-millisecond response times
- Memcached is a popular choice for powering real-time applications in
- Web and Mobile Apps
- Gaming
- Ad-Tech
- E-Commerce.
- Storage is not persistent
- Can not be used as a data store. If the node fails, the cached data (in the node) is lost
- If the node restarts, data is lost
- Ideal front-end for data stores (RDS, DynamoDB…etc)
- Use cases:
- Cache contents of a DB
- Cache data from dynamically generated webpages
- Transient session data
- High frequency counters for admission control in high volume web Apps
- Does not support
- Multi-AZ failover
- Replication
- Snapshots
Amazon Elasticache – Redis
- Built on open-source Redis and compatible with the Redis APIs
- Is persistent – snapshot can be taken
- At any time, you can restore your data by creating a new Redis cluster
- Supports Redis master/slave replication
- Supports snapshots (automatic and manual) to S3
- You can copy your snapshots to other AWS regions
- Use cases:
- Web and Mobile Apps
- Healthcare Apps
- Financial Apps
- Gaming, Ad-Tech, and IoT
- Multi-AZ is done by creating read replica(s) in another AZ in the same region
- Clustering mode disabled:
- Your Redis cluster can have only one shard
- One shard can have one read/write primary node and 0-to-5 read only replicas
- You can distribute the replicas over multiple AZs in the same region
- Replication from the primary node to the read replica is asynchronous
- Applications can read from any node in the cluster, but can write to the primary node only
- Clustering mode enabled:
- Your Redis cluster can have up to 15 shards,
- With the data partitioned across the shards
- Each shard has one primary node and –5 read only replicas
- Snapshots can slow down your nodes, better take snapshots from the read replicas
ElastiCache – Redis vs Memcached
Redis | Memcached |
Multi AZ with Auto-Failover | Multi-node for partitioning of data (sharding) |
Read Replicas to scale reads and have high availability | Multi-threaded architecture |
Persistence | Non persistent |
Backup and restore features | No backup and restore |
AWS ElastiCache