Distributed systems consistency: caches, retries and data integrity
Why users can see stale data after a database update, and how replication, caching and idempotency interact.
A database update does not guarantee an instant global view
An admin update can be correct in the primary database while a CDN cache, application cache or read replica returns an older value. Diagnose the discrepancy by tracking which layer served which version and timestamp. Verifying the database alone does not prove that the user-facing website shows the latest state.
Consistency is a business requirement
Strong consistency gives tighter guarantees for what a read observes after a successful write. Eventual consistency permits replicas to differ temporarily before converging. The required guarantee depends on the business rule: payment and inventory may be critical, while a small lag in a page-view counter may be tolerable. Applying one model everywhere can be costly.
Retries must be idempotent
A client may time out after the server has already completed a write but before the response arrives. Retrying without a stable identity can create duplicate invoices or comments. Idempotency keys, unique constraints and durable operation IDs let several attempts represent one logical action. Use bounded retries with backoff rather than unending loops.
Verify the whole path
Validate the admin API response, durable database revision, cache invalidation and public page as one workflow. Exposing a source revision or ETag can make discrepancies easier to diagnose. Even fast systems need failure tests before promising immediate global visibility across regions.
Comments
0 real commentsNo real reader comments yet.
✎ Write a comment