Design Waiting Room

Medium65 min
1 / 30
understanding6 min read

Problem framing and waiting room goals

Deep-dive section for problem framing and waiting room goals

Problem framing and waiting room goals

In this understanding section, we design waiting room behavior for live communication systems where hosts must admit participants safely and quickly. The objective is predictable admission latency, explicit host control, and clear fallbacks when host devices disconnect or overload.

We model the waiting room as a queue-backed state machine with strict transitions: requested -> waiting -> admitted or rejected. This keeps the server authoritative and prevents race conditions where multiple host actions or reconnecting clients create conflicting outcomes.

Operationally, we enforce bounded queue depth per meeting, idempotency keys on all mutations, and deterministic ordering keys for fair processing. We also maintain audit records for admission decisions so support and compliance teams can reconstruct who admitted whom, when, and from which client context.

From an interview perspective, explicitly calling out consistency boundaries is important: host decisions require strong consistency, while presence fan-out can remain eventually consistent. This allows low-latency UI updates without compromising admission correctness.

Multi-language reference implementation

javaOne Dark Pro
1public final class WaitingRoomPolicy {
2 public boolean canAdmit(final int currentParticipants, final int maxParticipants) {
3 return currentParticipants < maxParticipants;
4 }
5}
pythonOne Dark Pro
1from dataclasses import dataclass
2
3@dataclass
4class WaitingRoomPolicy:
5 max_participants: int
6
7 def can_admit(self, current_participants: int) -> bool:
8 return current_participants < self.max_participants
typescriptOne Dark Pro
1export function canAdmit(currentParticipants: number, maxParticipants: number): boolean {
2 return currentParticipants < maxParticipants;
3}

Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes: Additional implementation notes:

Why interviewers care

Waiting Room interviews reward crisp scope, explicit trade-offs, and failure stories—not generic microservice diagrams.

The failure that defines the design

The outage to narrate is the lost knock or the lost admit. A participant clicks join, lands in the waiting room, and never appears on the host's panel — so they wait forever for a host who does not know they are there. Or the host clicks admit, the admit event is dropped, and the participant sits in limbo while the host believes they let them in. The fix is the spine of the design: make the admission decision the durable source of truth, model admission as an idempotent state transition, and gate the media join on a token minted only by that transition. A knock that is not yet acknowledged is retried; an admit that is re-delivered is a no-op. State admission-as-durable-decision up front, because a waiting room that loses a knock or an admit fails its one job — controlling who gets in.

Key Highlights

  • Model waiting room with explicit state transitions and idempotent mutations.
  • Separate strong-consistency admission writes from eventual-consistency presence fan-out.
  • Use partitioned queues keyed by meeting ID to avoid cross-room contention.
  • Attach trace IDs to host actions for forensic debugging and auditability.
Signal
State consistency boundaries explicitly; this demonstrates production judgment.
Delivery
Quantify P95/P99 for queue and admission operations to anchor your design.

Section Rescue Kit

Buzzwords to use:

Admission IdempotencyShard Affinity

Safe statements:

  • "Let me lock the consistency boundary first, then optimize latency around that decision."
  • "I will keep the admission path simple and deterministic before layering optional enhancements."
Design Waiting Room - System Design | WinJob | WinJob