AWS ElastiCache with Redis Part-1
- Amazon ElastiCache allows you to seamlessly set up, run, and scale popular open-source compatible in-memory data stores in the cloud.
- Build data-intensive apps or boost the performance of your existing databases by retrieving data from high throughput and low latency in-memory data stores.
- Amazon ElastiCache is a popular choice for real-time use cases like Caching, Session Stores.
- By utilizing an end-to-end optimized stack running on customer dedicated nodes, Amazon ElastiCache provides secure, blazing-fast performance.
- ElastiCache continuously monitors your clusters to keep your workloads up and running so that you can focus on higher-value application development.
- Amazon ElastiCache can scale out, scale in, and scale up to meet fluctuating application demands. Write and memory scaling is supported with sharding. Replicas provide read scaling.
Cache Hit and Cache Miss
- A cache hit describes the situation where your site’s content is successfully served from the cache.
- The tags are searched in the memory rapidly, and when the data is found and read, it’s considered as a cache hit.
- A cache hit can also be described as cold, warm, or hot.
- In each of these, the speed at which the data is read is described.
- In hot cache memory at the fastest possible rate. This happens when the data is retrieved from L1.
- In cold cache data is read at the lowest possible rate, though, it’s still successful so it’s still considered a cache hit.
- The data is just found lower in the memory hierarchy such as in L3, or lower.
- In warm cache data is found in L2 or L3. It’s not as fast as a hot cache, but it’s still faster than a cold cache.
- Generally, calling a cache warm is used to express that it’s slower and closer to a cold cache than a hot one.
- A cache miss refers to the instance when the memory is searched and the data isn’t found.
- When this happens, the content is transferred and written into the cache.
- Redis is an in-memory data storage.
- Data is stored in the form of key-value pairs.
- Redis means remote dictionary server.
- We can keep our data on disk with a time snapshot so that recovery can be done.
- Multiple replicas can be created.
- Transactions are supported, so atomicity is maintained.
- Pub/Sub is supported.
- Transactions can be executed using scripts.
- No multi-threading is there.
- For security- redis auth, TLS, At-Rest encryption are provided.
- Lazy loading means that data will retrieve only from the cache until or unless it is not present in the cache.
- That is there is no cache miss, in the case of cache miss database will be hit and the result will be stored in the cache.
Write Through and TTL (Time to Live)
- WriteThrough adds or updates the data in the cache whenever changes are made in the database because this data in the cache is the latest.
- Latency will be there as two operations are performed whenever DB is updated – write on DB and write on the cache.
- TTL is the time after which the key will expire.
- If an expired key is referred then it will be referred to as a cache miss, and a new entry will be created for it.
- TTL can be in seconds and milliseconds.
- Write Through prevents stale data.
- TTL helps in removing the unused data from the cache.
- ElasitCache is very useful in the case where extreme performances are required.
- Because of in-memory data storage, very fast performance is providing.
- Auto Scaling helps in controlling the scalability of the product.
- User-based authentication is provided so that there are no security issues.
- It is a fully managed service.
- ElastiCache is Redis compatible.
- High Availability and Reliability make it very easy to use.
- ElastiCache is very easy to scale.
- Real-time transactions and analytics can be easily done.
- Chat and Messaging
- Gaming Leaderboards
- Machine Learning
- Media Streaming
- Real-time Analytics
- Session Storage
Company’s Using ElastiCache with Redis
In this part, we have covered the basics of ElastiCache using Redis, in the upcoming part we will cover the implementation and demonstration.
Link To Part-2:
- Utkarsh Shukla Website – https://utkarshshukla.herokuapp.com/