- Discussion
- Useful Resources
- Quick Guide
- Managing Costs
- Managing Tags
- Events
- SNS Notifications
- IAM policies
- Delete Memcached Cluster
- Connecting to Cluster in VPC
- Creating Memcached Cluster
- Memcached VPC
- Add TTL
- Write Through
- Lazy Loading
- Accessing Memcached Cluster
- Memcached & Redis
- Monitoring Node - Metrics
- Backup and Restore
- Engine Parameters
- Deleting Parameters
- Listing Parameters
- Parameter Group
- Redis Shards
- Delete Cluster
- Scaling the Clusters
- Removing Nodes
- Adding Nodes
- Rebooting Cluster
- Modifying Cluster
- Accessing Cluster
- Cluster Endpoints
- Viewing Cluster Details
- Launching Cluster
- Interfaces
- Environment
- Overview
- Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
AWS ElastiCache - Write Through
Like lazy loading, write through is another caching strategy but unpke lazy loading, it does not wait for a hit or miss. It is a straight forward strategy in which the syncing between cache and database happens as soon as some data is written into the database.
It can be easily understood from the below diagram.
![Write Through](/awselasticache/images/write_through.jpg)
Advantages of Write Through
Data in the cache is never stale − Since the data in the cache is updated every time it is written to the database, the data in the cache is always current.
Write penalty vs. Read penalty − Every write involves two trips, a write to the cache and a write to the database.
This adds latency to the process. That said, end users are generally more tolerant of latency when updating data than when retrieving data. There is an inherent sense that updates are more work and thus take longer.
Disadvantages of Write Through
Missing data − In the case of spinning up a new node, whether due to a node failure or scapng out, there is missing data which continues to be missing until it is added or updated on the database. This can be minimized by implementing Lazy Loading in conjunction with Write Through.
Cache churn − Since most data is never read, there can be a lot of data in the cluster that is never read. This is a waste of resources. By Adding TTL you can minimize wasted space, which we will see in the next chapter.