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?
Won’t the cache be updated only when there is an add/update? The question does say that it’s read heavy. Can stale data be fixed by applying a ttl?
Though write through would be the best answer in case there are no records to begin with. What the safe assumption for the exam? Always start from scratch unless explicitly stated that it contains existing data?