ElastiCache Flashcards
What is ElastiCache?
Fully managed in-memory data store, compatible with Redis or Memcached
What are the main features of ElastiCache?
really high performance and sub-millisecond latency.
What does involve to use ElastiCache in your application?
heavy code changes
What must have ElastiCache to make sure only the most current data is used?
an invalidation strategy
How does work the mechanism among Applications - ElastiCache - RDS?
Applications queries ElastiCache, if not available, get from RDS and store in ElastiCache
What is a common use case for ElastiCache?
To save User Session Store
What is distinctive on ElastiCache Memcached?
sharding, non persistent, no backup and restore, multithreading
What is distinctive on ElastiCache Redis?
Multi AZ with failover, read replicas, data durability using AOF, backup and restore
How can you use IAM authentication for ElastiCache?
ElastiCache does not support it
In terms of security what does ElastiCache support?
SSL in flight encryption
How are IAM policies used on ElastiCache?
only for API-level security
What does Redis provide for extra security of ElastiCache?
Redis AUTH, a password/token when you create a Redis cluster on top of SGs
What does Memcached provide for extra security of ElastiCache?
Supports SASL-based authentication (advanced)
Simple Authentication and Security Layer
What are the patterns for ElastiCache?
- Lazy Loading / Cache-Aside / Lazy Population
- Write Through
- Session Store
What is ElastiCache’s Lazy Loading / Cache-Aside / Lazy Population pattern?
It is the known pattern
What is ElastiCache’s Write Through pattern?
Adds or update data in the cache when written to a DB (no stale data)
What is ElastiCache’s Session Store pattern?
store temporary session data in a cache (using TTL features)
What are the pros of ElastiCache’s Lazy Loading / Cache-Aside / Lazy Population pattern?
- Only requested data is cached (the cache isn’t filled up with unused data)
- Node failures are not fatal (just increased latency to
warm the cache)
What are the cons of ElastiCache’s Lazy Loading / Cache-Aside / Lazy Population pattern?
- Cache miss penalty that results in 3 round trips, noticeable delay for that request
- Stale data: data can be updated in the database and outdated in the cache
What are the pros of ElastiCache’s Write Through pattern?
- Data in cache is never stale, reads are quick
- Write penalty vs Read penalty (each write requires 2 calls)
What are the cons of ElastiCache’s Write Through pattern?
- Missing Data until it is added / updated in the DB. Mitigation is to implement Lazy Loading strategy as well
- Cache churn – a lot of the data will never be read
How can occur ElastiCache’s Cache eviction?
In three ways:
• You delete the item explicitly in the cache
• Item is evicted because the memory is full and it’s not recently used (LRU)
• You set an item time-to-live (or TTL)
For what kind of data are helpful ElastiCache’s TTL?
TTL are helpful for any kind of data:
• Leaderboards
• Comments
• Activity streams
What to do if too many ElastiCache’s evictions happen due to memory
you should scale up or out
What is the range of ElastiCache’s TTL?
TTL can range from few seconds to hours or days
What ElastiCache pattern is easy to implement and works for many situations as a foundation, especially on the read side?
Lazy Loading / Cache aside
With what is usually combined ElastiCache’s Write-through pattern?
with Lazy Loading as targeted for the queries or workloads that benefit from this optimization
Setting a TTL is usually not a bad idea, except when…
you’re using Write-through. Set it to a sensible value for your application
What is an anti-pattern for ElastiCache?
data changing rapidly, all large key space frequently needed