Learning on Web Dev Open is free for all.

System Design & Performance > Scale, consistency and failureWhat you are promising about correctness
Phase 06Scale, consistency and failure313 of 434

What you are promising about correctness

Strong, eventual and the useful middle. Consistency is a promise to your users, so state it in their language.

Concept15 minAI pair

Strong consistency means every read sees the latest committed write, at the cost of coordination, and coordination costs latency, which costs more the further apart your machines are. Eventual consistency means copies converge given time, and in exchange you get availability and speed. Neither is a virtue; they are prices, and the interesting systems pay different prices for different operations.

Per-operation is the right granularity. Account balance and inventory decrement want strong guarantees. A like count, a view count, a recommendation list and a search index are fine being seconds behind, and insisting otherwise buys latency nobody asked for. A single application routinely wants both, which is why "we chose eventual consistency" is rarely a complete sentence.

Say it in user language when you write it down. "You will always see your own changes immediately; other people may take up to five seconds to see them; counts may lag by a minute" is a specification a product manager can approve and an engineer can test. Read-your-writes, monotonic reads and the rest are the technical names for guarantees that only matter because of sentences like that one.

You should now be able to

  • Describe strong and eventual consistency without invoking CAP as a slogan
  • Choose a consistency level per operation rather than per system
  • Express a consistency guarantee as user-visible behaviour
Ask the community

Loading…