liveBook · Manning

Fault tolerance

As explained in Acing the Frontend Interview

Fault tolerance is the ability of a system to continue providing acceptable service despite component failures or disruptions.

Fault tolerance keeps a system providing acceptable service when components fail or disruptions occur. Distributed designs pursue it through layered caching, replicated data, and continued service from surviving nodes. section 6.4 section 6.5

Evaluate fault-tolerant designs through these practical mechanisms and trade-offs:

  • Use multi-tier caching to reduce load and latency while improving resilience; balance the benefit against cache consistency, invalidation, observability, and tuning complexity. section 6.4
  • Replicate data across nodes so surviving replicas can continue serving requests when one node fails; weigh availability and durability against consistency, latency, and operational complexity. section 6.5
  • Discuss asynchronous replication, stale reads, conflicts, replication lag, and quorum reads or writes when explaining reliability beyond basic availability. section 6.5

Primary database with read replicas

Write user profiles, settings, and permissions to a primary database, then asynchronously replicate them to two replicas serving dashboards and profile views. If the primary fails, replicas can continue serving reads, preserving availability and durability. section 6.5

Table 6.5 Caching strategies
Topic
Fundamentals
Applied skills
Advanced
In-memory caches
Understand key-value storage (e.g., Redis, Memcached). Use TTLs (Time To Live) and LRU (Least Recently Used).
Cache sessions, tokens, and user profiles. Use cache-aside or write-through strategies.
Implement eviction policies, handle cache stampedes, and tune Redis clustering or persistence.
Client-side caching
Know how browsers use localStorage, sessionStorage, IndexedDB, and HTTP caching headers.
Control asset and API caching with Cache-Control, ETag, and Last-Modified.
Implement service workers, stale-while-revalidate, and offline-first strategies for PWA-like resilience.
CDN caching
Understand what a CDN is and how it caches static content at edge nodes.
Configure HTTP headers for control ( Cache-Control, ETag, Expires). Use Cloudflare, CloudFront.
Apply edge-side includes (ESI), handle cache purges, and tune stale content policies for dynamic content.
Application- level caching
Use in-process caches (e.g., LRU). Avoid repeated function calls.
Use decorators ( @Cacheable), middleware, or sidecar caches. Cache expensive computations.
Design multi-tiered caches across services. Use memoization with TTLs and dependency-based invalidation.
Database caching
Understand in-memory query result caching, buffer pools, and materialized views.
Cache frequent or expensive queries (e.g., dashboards, reports) using Redis or similar. Use query fingerprinting to identify reuse patterns.
Maintain consistency with write-through or write-behind strategies. Apply triggers, smart polling, or TTL-based invalidation to keep cache fresh under frequent writes.
Distributed/
multi-tiered caching
Know benefits of shared, distributed cache across nodes.
Use Redis Cluster or Hazelcast. Cache API responses shared across instances.
Orchestrate cache layers (client → edge → app → DB). Implement cache federation and tiered fallback strategies.

Compare in-memory, client-side, CDN, and multi-tier caching by fundamentals, applied skills, and advanced resilience techniques. section 6.4

Table 6.6 Data replication, sharding, and partitioning
Topic
Fundamentals
Applied skills
Advanced
Data replication
Understand that data is copied across nodes to improve availability and fault tolerance.
Use leader-follower or multi-leader replication. Tune sync vs. async replication. Handle stale reads and conflicts.
Optimize replication lag, implement quorum reads/writes, and reason about consistency in geo-replicated systems.
Sharding (horizontally partitioning)
Understand that data is split across multiple databases or nodes, usually by key.
Implement horizontal scaling using range-based or hash-based sharding. Handle rebalancing and routing logic.
Design for cross-shard transactions, hotspot detection, and dynamic resharding without downtime.
Partitioning
Know that partitioning divides data into independent subsets for manageability and parallelism.
Apply vertical vs. horizontal partitioning. Use partitioning to reduce query latency and contention.
Design partition-aware data models and query strategies. Handle skew, repartitioning, and partition pruning at scale.

Compare replication, sharding, and partitioning by their roles in availability, scaling, consistency, and operational design. section 6.5

How Acing the Frontend Interview covers it

How deep it goes
Explains resilience through caching and replication, including availability, failover, consistency, latency, and operational trade-offs.
Examples
Uses multi-tier caches, LRU eviction, primary–replica databases, asynchronous replication, and automatic failover as concrete examples.
What it assumes
Assumes distributed-system fundamentals and familiarity with availability, consistency, latency, databases, and caching.
What you can do after
Evaluate distributed designs by explaining how caches and replicas preserve service, then defend their consistency and complexity trade-offs.
How it connects
Connects fault tolerance to caching, data replication, sharding, partitioning, high availability, consistency, latency, and durability.

Also explained in

Compare how 6 books explain fault tolerance →

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.