Practice
Solution
Step 1: Identify the need for strong coordination
Preventing double booking requires distributed synchronization to ensure only one reservation succeeds for a room at a given time.Step 2: Evaluate coordination mechanisms
Relational DB unique constraints (Use a relational database with unique constraints on room and date columns to prevent duplicates) can help but may cause high contention and deadlocks at scale. NoSQL with last-write-wins (Use an eventually consistent NoSQL store with last-write-wins conflict resolution) allows conflicts and can cause double bookings. Client-side validation (Use client-side validation to check room availability before submitting reservations) is unreliable due to race conditions. Distributed lock service (Use a distributed lock service like ZooKeeper to coordinate reservation attempts) provides strong consistency and coordination across distributed components.Final Answer:
Option A -> Option AQuick Check:
Distributed locks coordinate concurrent reservations reliably [check]
Solution
Step 1: Understand Kafka's role in fan-out
Kafka buffers fan-out events; Delivery Workers consume from Kafka to deliver posts asynchronously.Step 2: Trace failure impact
If Kafka crashes and loses messages, Delivery Workers waiting on those messages block or stall, causing delivery delays.Step 3: Eliminate other options
Duplicates (A) occur with retries, not loss. Lost posts (B) happen but are not the immediate failure mode. Fallback to synchronous push (D) is not automatic.Final Answer:
Option D -> Option DQuick Check:
Kafka crash causes Delivery Workers to block waiting for lost messages [check]
Solution
Step 1: Trace failure impact of message queue outage
The queue decouples upload and transcoding. Without it, upload service cannot enqueue transcoding jobs. Uploads succeed but transcoding workers receive no tasks, so no processed videos are generated. Blocking upload (B) is incorrect because upload is asynchronous. Duplicate transcoding (A) is unrelated. View count errors (D) happen downstream, not due to queue failure.Step 2: Confirm exact failure mode
Uploads accepted but stuck before transcoding is the precise failure.Final Answer:
Option A -> Option AQuick Check:
Queue failure causes transcoding jobs to be lost, no processed videos [check]
Solution
Step 1: Role of message broker
Broker decouples sender and receiver, enabling asynchronous delivery and retries.Step 2: Consequence of missing broker
Without it, messages are sent synchronously causing sender blocking; if receiver crashes, messages are lost; encryption (A) unaffected; blocking and loss (C) is exact failure; batch mode (D) not automatic.Final Answer:
Option A -> Option AQuick Check:
Broker removal causes blocking sends and message loss on receiver failure [check]
Solution
Step 1: Identify HTTP/3 transport and encryption
HTTP/3 uses QUIC over UDP with built-in TLS encryption per connection, increasing CPU load for handshake and encryption at scale.Step 2: Eliminate other bottlenecks
UDP packet loss is network-level, not server bottleneck; WebSockets are not natively supported by HTTP/3 but unrelated to scaling HTTP/3 itself; HTTP/3 does not use TCP.Final Answer:
Option B -> Option BQuick Check:
QUIC's per-connection TLS handshake CPU load limits HTTP/3 scale [check]
