liveBook · Manning

Consistency model

As explained in Acing the Frontend Interview

A consistency model specifies the guarantees governing the visibility and ordering of updates across replicas in a distributed system.

A consistency model specifies how updates become visible across replicas and what ordering guarantees reads receive. It frames distributed-system trade-offs between freshness, availability, and failure tolerance. section 6.0 section 6.2

Interview discussions commonly distinguish these guarantees:

  • Strong consistency returns the most recent write or an error, making it appropriate for correctness-sensitive applications such as financial systems. section 6.2
  • Eventual consistency favors continued availability while replicas converge, fitting use cases such as social-media feeds. section 6.2
  • Causal and read-your-writes consistency provide intermediate guarantees that preserve selected relationships between updates and subsequent reads. section 6.2

A practical interview comparison

When choosing between correctness and availability during distributed operation, justify strong consistency with PostgreSQL for financial applications and eventual consistency with Cassandra or DynamoDB for social feeds. Explain the expected behavior when replicas lag or communication fails. section 6.2

Table 6.3 Distributed computing fundamentals
Topic
Fundamentals
Applied skills
Advanced
CAP theorem
Understand that a distributed system can only guarantee two of: consistency, availability, and partition tolerance.
Classify real systems as CP, AP, or CA. e.g., DynamoDB is AP; HBase is CP. Explain trade-offs during network failures.
See appendix A.13 for details.
Evaluate architectural decisions under partition scenarios. Justify consistency/availability choices in critical systems.
Consistency models
Know the difference between strong consistency and eventual consistency. Recognize intermediate models like causal and read-your-writes.
Select appropriate models based on system requirements—Use strong consistency (e.g., PostgreSQL for financial applications, and eventual consistency (e.g., Cassandra or DynamoDB) for social media feeds. Implement tunable consistency settings when supported to balance performance and correctness.
Analyze and optimize consistency guarantees in distributed storage or multi-region deployments. Design around consistency anomalies.
Consensus
Understand the purpose of consensus in distributed systems (e.g., agreement despite failures). Know examples like Paxos and Raft.
Use consensus algorithms for leader election, quorum writes, or log replication (e.g., etcd — https://etcd.io, ZooKeeper— https://zookeeper.apache.org). Handle node failures and retries.
Evaluate and tune consensus performance under network partitions. Compare protocols (Raft vs. Paxos) in terms of safety, liveness, and complexity.
Constraints
Understand that distributed systems face inherent challenges such as partial failures (some nodes fail while others function), network latency, and messages arriving out of order or being lost.
Design applications to handle retries, timeouts, and idempotency. Implement patterns like heartbeats, acknowledgments, and sequence numbers to detect and mitigate message reordering or loss.
Architect fault-tolerant systems that maintain correctness under adverse conditions. Simulate failures (e.g., chaos engineering) to validate resilience. Optimize protocols for latency-sensitive workloads while tolerating network-level issues.

Compare consistency models by foundational knowledge, applied selection, and advanced architectural evaluation. section 6.2

How Acing the Frontend Interview covers it

How deep it goes
Defines strong and eventual consistency, names intermediate models, and stops short of detailed implementation mechanics.
Examples
Uses PostgreSQL for financial applications and Cassandra or DynamoDB for eventually consistent social-media feeds.
What it assumes
Assumes distributed-computing fundamentals and introduces strong, eventual, causal, and read-your-writes consistency distinctions.
What you can do after
Evaluate consistency choices against correctness, availability, replica lag, and distributed-system failure scenarios.
How it connects
Connects consistency models to CAP theorem, availability, partition tolerance, distributed databases, and consensus protocols.

Also explained in

Compare how 7 books explain consistency model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Frontend Interview. The section links point to the parts of the book it draws on.