AWS Elasticache Memcached
General
- ElastiCache is protocol compliant with Memcached, can use any tool
- Multi-threaded, can take full advantage of multi-core EC2
- Use consistent hashing - add additional nodes to scale horizontally
Scaling and Autodiscovery and Consistent Hashing
- Use for adding new nodes and scaling
- AWS automatically repairs or replaces a cache node, the Domain Name Service (DNS) name of the cache node will remain the same
Best Practices
- Always apply a time to live (TTL) to all of your cache keys, except those you are updating by write-through caching (avoids bugs, the cache key will auto-expire and get refreshed).
- When in doubt, just delete a cache key if you're not sure whether it's affected by a given database update or not. Your lazy caching foundation will refresh the key when needed.
- Pre-warm cache with script or by hitting the url
- To avoid thundering herd problem, add some randomness to your TTL: ttl = 3600 + (rand() * 120) /* +/- 2 minutes */