ElastiCache and AWS CLI Flashcards
When should you not cache data
When you deal with anti-patterns, where data is changing rapidy
What is the lazy loading caching pattern
If application cache miss in elasticache, it reads from D.B and writes back to cache
What are the pros and cons of the lazy loading caching pattern
Pros: Only requested data is cached (the cache isn’t filled up with unsued data). Node failures are not fatal.
Cons: Cache miss penalty that results in 3 round trips, noticeable delay for that request.
Stale data: Data can be updated in database but not in cache
What is the WriteThrough caching pattern
If application cache miss, it writes to the D.B, then writes to teh cache
What are the pros and cons of the WriteThrough caching pattern
Pros: Data in cache is never stale, reeads are quick. Write penaly vs. Read penalty(each write requires 2 calls.
Cons:
Missing data until it is added/updated in the D.B.
A lot of data will never be read.
What are the three ways of cache evictions?
You delete the item explictily in the cache
Item is evicted becasue the memory is full and it’s not recently used (LRU)
You set an item TTL
When should you not set a TTL
When you’re using WriteThrough
Do read replicas require us to change our SQL connection string?
Yes, they add new endpoints for databases to read from
How does your organization enforce SSL connections on your MySQL database?
Apply a ‘Require SSL’ statement to all your users in your SQL database
If you get an AWS command not found:
The aws executable is not in the PATH environmental variable
EC2 instance metadata and url:
- Allows Ec2 instances to “learn about themselves” without using an IAM role for that purpose.
- IP: 169.254.169.254/latest/meadata
- Can retrieve IAM role name but not policy.
If you want to perform actions on AWS directly from your application code?
Use an AWS Sdk
API Rate limits
Describe Instances API for Ec2 has a limit of 100 calls per second.
GetObject on S3 has a limit of 5,500 GET per second per prefix
For Interment Errors:
Implement exponential back off
For consistent errors
Request an API throttling limit increase