Caching Overview
What is caching? Example: buying a freezer 25 feet away, then buying ice cream at a factory 25 miles away.
Where do we cache? We cache data thats going to be returned to our users (images, videos, and static content). We can cache internally as well – caching queries that query our databases.
4 AWS Solutions
- CloudFront – a content distribution network
- ElastiCache – internal caching solution, sit in front of databases
- DAX – DynamoDB accelerator, built specifically for DynamoDB
- Global Accelerator – another tool to speed up external connections
Whenever possible, pick an answer that includes a caching solution.
CloudFront
Cloudfront is a fast CDN service that securely delivers data, videos, applications, and APIs to customers globally. It helps reduce latency and provide higher transfer speeds using AWS edge locations.
Security – if you want to route your entire domain through cloudfront, its simple to do. Defaults to HTTPS connections. Put a secure connection on your s3 static websites.
Global Distribution – you can’t pick specific countries, just general areas of the globe. If you want to block countries, use the Web Application Firewall. Can be used to front AWS endpoints along with non-aws applications. You can force an expiration of content from the cache if you can’t wait for the TTL.
Option to restrict access points such as signed urls and signed cookies.
Caching your data with ElastiCache and DAX
What is ElastiCache? Its a managed version of Memcached and Redis, neither tools are specific to AWS but you can avoid a lot of common issues.
Memcached
- Simple database caching solution
- Not a database by itself
- No failover or Multi-AZ support
- No backups
Redis
- Supported as a caching solution
- Functions as a standalone database
- Failover and Multi-AZ support
- Supports backups
DynamoDB Accelerator (DAX)
- In-Memory Cache
- Can reduce DynamoDB response times from milliseconds to microseconds
- You get to determine the node size, count for the cluster, TTL for the data, maintenance windows and update windows
Pick answers that have a caching solution. The exam won’t dive into deeply into any one caching solution.
Fixing IP Caching with Global Accelerator
What is Global Accelerator? A networking service that uses the AWS global network infrastructure. Help deal with IP caching. Global Accelerator gives 2 IP addresses, doesn’t matter since global accelerator sits between users and the load balancer. Traffic is routed through AWS’s global network infrastructure. Can create weighted pools behind the IPs to test out new features or handle failure in your environment.
Caching exam tips
4 questions –
- Can it be cached?
- What kind of cache should be used?
- How does the content get updated?
- Does it add anything besides speed?
CloudFront is the only option to add HTTPS to a static website being hosted in an S3 bucket. Always favor answers that include caching. The exam doesn’t usually dive into the additional costs and instead frames caching only in the positive. Global Accelerator is your friend whenever the scenario talks about IP caching. Its primary use on the test will be to reduce issues with customers caching old IP addresses.
In Memory databases: redis and dynamodb. If the scenario offers dyanmoDB, pick that. Redis has more features than memcached. Backups are not supported on any solutions besides Redis. Memcached and DAX are not a source of truth for your data, they are just for performance.