Menu
Back to Discussions

Cache-aside usually makes more sense than write-through or write-back when your application often reads data that rarely changes, and you need to keep your database consistent.

Maral Doszhanova
Maral Doszhanova
·2356 views
Okay, so you're building a new service and thinking about caching. I hear you on cache-aside, it's usually my go-to because it's so easy to get up and running. But yeah, write-through and write-back caches definitely have their moments, especially when consistency or speed is a big deal. For a service like yours, with a good amount of reads but also a fair number of writes, when would I switch? Well, if those writes absolutely, positively need to be consistent right away, or if you're hitting performance bottlenecks because every write has to wait for the database, that's when I'd start looking at write-through or write-back. Think about data patterns where multiple services might be trying to update the same record, or when you simply cant afford any lag on write operations. Those are the times I'd consider the extra work for one of those write strategies.
40 comments

Comments

Loading comments...