Practice
Solution
Step 1: Role of write-ahead log (WAL)
WAL ensures durability by recording changes before commit; without it, recovery cannot guarantee committed data.Step 2: Trace failure on crash without WAL
Database must block new transactions and perform full recovery to avoid inconsistent state, causing availability loss.Final Answer:
Option B -> Option BQuick Check:
No WAL -> recovery blocks new transactions to maintain consistency [check]
Solution
Step 1: Understand flash sale constraints
Flash sales require high availability and low latency during spikes; strict consistency can cause blocking and failures.Step 2: Evaluate architectures
Strong consistency with sync replication (A) causes high latency and availability loss under partitions. Single master (C) bottlenecks writes. Distributed locks (D) serialize requests, hurting throughput. Eventually consistent cache with async writes (B) allows high availability and scales under burst, tolerating slight delays.Final Answer:
Option A -> Option AQuick Check:
Async writes + eventual consistency -> high availability under spikes [check]
Solution
Step 1: Understand role of token assignment metadata
Token metadata maps virtual nodes to physical nodes; losing it breaks new node integration.Step 2: Trace failure impact
Existing nodes continue serving keys assigned before loss; new nodes cannot be assigned tokens properly.Final Answer:
Option A -> Option AQuick Check:
Token metadata loss blocks new node assignment; existing nodes unaffected [check]
Solution
Step 1: Understand health check module role
Health checks detect unhealthy servers; without them, no updates occur to remove bad servers.Step 2: Trace routing behavior without health checks
Load balancer routes to all servers indiscriminately, including unhealthy ones, causing client errors.Final Answer:
Option D -> Option DQuick Check:
No health checks -> no removal of unhealthy servers -> client errors [check]
Solution
Step 1: Identify consistency and update requirements
Strong consistency and immediate update notification are required.Step 2: Evaluate options
Distributed cache with eventual consistency delays updates; relational DB polling adds latency; message queue is asynchronous without state storage.Final Answer:
Option A -> Option AQuick Check:
Zookeeper watches -> immediate, consistent config updates [check]
