System Design Expert — Series 2

Preview — 3 of 10 questions

In a distributed system using the Raft consensus algorithm, multiple nodes need to agree on a single leader to coordinate writes. What happens if the current leader crashes or becomes unreachable?

AThe entire cluster becomes permanently unavailable until a human operator manually designates a new leader
BFollowers that stop receiving heartbeats from the leader within a timeout period become candidates and initiate a new election, requesting votes from the rest of the cluster; a candidate that wins votes from a majority of nodes becomes the new leader — that majority requirement guarantees at most one leader can be elected per term, even under network partitions
CAny node can unilaterally declare itself the new leader with no voting process at all, since consensus algorithms don't actually require agreement
DRaft requires the entire cluster to halt processing for a fixed 10-minute cooldown before any new leader can be elected

A globally distributed database accepts writes in multiple regions simultaneously, even during a network partition between regions. When the partition heals, conflicting concurrent writes to the same value must be reconciled automatically — with no data loss and no central coordinator making the call. What class of data structure enables this?

ARegular relational tables with foreign key constraints — these automatically resolve any write conflict on their own
BA single global lock that blocks all writes everywhere until the partition heals
CCRDTs (Conflict-free Replicated Data Types) — data structures specifically designed so that concurrent, independently-made updates can always be merged deterministically into a consistent result (e.g., a grow-only counter that simply sums every increment from every replica, or a last-writer-wins register resolved by timestamp) — without requiring any coordination between replicas at write time
DTwo-Phase Commit, which prevents any writes from being accepted at all during a partition, avoiding conflicts by refusing to allow them

Design a video streaming service that must deliver smooth playback to users with wildly varying network conditions (3G mobile through gigabit fiber), without constant buffering or forcing everyone onto the lowest common quality. What's the standard technique?

AEncode the video once, at a single fixed high bitrate, and let the client's video player handle any network issues entirely on its own
BForce every client to fully download the entire video file before playback begins, eliminating the need for any quality adaptation
CAdaptive bitrate streaming only works for live broadcasts — pre-recorded, on-demand video has no equivalent technique
DAdaptive bitrate streaming: encode the same video into several quality/bitrate variants ahead of time, split each variant into small chunks (a few seconds each), and have the client continuously monitor its own available bandwidth, requesting whichever quality's chunk it can download comfortably in time for smooth playback — switching quality up or down, chunk by chunk, as network conditions actually change

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.