Grokking the System Design Interview
Ask Author
Back to course home

0% completed

Vote For New Content
asif malek
What if transaction fails at DB in write through cache scenario

asif malek

Apr 18, 2025

In write thru cache, we write data in db and cache at same time. What if cache write is a success and db write fails, then system will serve wrong data via cache.

0

0

Comments
Comments
Abhishek Kumar Gupta
Abhishek Kumar Gupta5 months ago

I think, In this case, transaction should be rolled-back to previous state.

Sid D
Sid D4 months ago

You update the cache AFTER the DB txn succeeds. not really simultaneous.