Architecture note2 lab guides2 lab guides
ElastiCache · Redis and Memcached
Eviction policies, cluster mode, and cache stampedes.
Outcome
- Explain why ElastiCache has no public endpoint and what the connection path must be
- Create a security group with source-SG inbound rule (not CIDR) for Redis port
- Explain the difference between ElastiCache control plane IAM and data plane AUTH tokens
- Debug a Redis connection timeout systematically (SG → subnet → NACL → host)
- Use String for cached responses, counters, and idempotency keys with TTL
- Use Hash for session objects with independently updatable fields
- Use Sorted Set for leaderboards and sliding-window time series
- Explain WRONGTYPE error and how to diagnose it with TYPE command
- Explain why EXPIRE returning 0 is a silent failure
- Use MGET to batch multiple key reads in one round-trip
- Implement cache-aside (read → miss → DB → SET with TTL → return) in a Lambda inside a VPC
- Explain volatile-lru vs allkeys-lru and when to use each
- Explain why noeviction is wrong for a cache and what happens when memory fills
- Explain why every key must have a TTL and what happens without one
- Namespace keys by service to prevent collision on shared Redis
- Use SUBSCRIBE/PUBLISH for cache invalidation signals
- Explain why Pub/Sub messages are lost if no subscriber is listening
- Use XADD/XREADGROUP/XACK for reliable audit log processing
- Explain XPENDING and how XCLAIM handles consumer failure
- Explain when to use Pub/Sub vs Streams vs SQS
- Create a replication group with automatic failover and Multi-AZ
- Read from replica endpoint, write to primary endpoint
- Trigger a failover and observe the ~30-second window
- Explain why writes to a replica fail with READONLY
- Explain what a client without retry logic experiences during failover
- Implement atomic rate limiting with SET NX EX + INCR
- Implement sliding window rate limiting with Sorted Set
- Acquire and release a distributed lock with random token and Lua atomic release
- Explain why lock without TTL causes permanent deadlock
- Explain why lock without random token allows double-release
- Create CloudWatch alarms on CacheHitRate and Evictions
- Interpret INFO memory and INFO replication output