There is a question in AWS Exam Readiness that I couldn’t figure out why the answer is to configure elasticache write through.
Here is the question:
"A company has an application that accesses a relational DB tier and runs on several EC2 instances placed behind an application load balancer. This application will now be used with a read-heavy workload to make medical records accessible to multiple insurance companies. Due to the nature of the data, compliance requires data protection at-rest and high availability, especially during sudden large peaks in load."
If it’s write through, then it has to add/update first the db before the cache gets filled. While Lazy Loading will have cache misses on the first run, the second run would make the data available in the cache. It says that it will be read-heavy so assuming that the first insurance company reads the data of a patient, the second insurance who will request for the same data would’ve hit the cache. Is there something that I am missing?
I think it may have something to do with managing the data expiration with Elasticcache. If you’re using the lazy loading, how do you ensure that you’re reading the most updated data from the cache. The write through cache is updated in real time when the database is updated.