Distributed Systems · core

Real-time Systems

WebSockets, server-sent events, presence, synchronization, ordering, reconnects, optimistic UI, and conflict handling.

distributed-systemssystem-designevent-driven

Mental model

Realtime messaging is two problems wearing one name. On the server it is long-lived connections plus fan-out: WebSockets are stateful, which constrains your load balancer, and choosing per-channel versus per-user fan-out is the central design decision. On the client it is maintaining a local projection of remote state that survives disconnects and reordering — so the protocol needs message identity, a sequence number, a reconnect-and-catch-up path, and a reconciliation rule for optimistic updates the server later rejects.

How to study Real-time Systems

Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use System Design Primer, RFC 6455 — The WebSocket Protocol, MDN — The WebSocket API to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.

Next, compare Real-time Systems with the neighboring concepts in its roadmap. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Realtime chat system, Design exercise: Real-time Application Engineering and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.

Proof of understanding

  • Explain the mechanism from first principles and identify the state it reads or changes.
  • Give one situation where the concept is the right choice and one where it is not.
  • Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
  • Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.

Common mistakes

  • Sticky sessions as the only fan-out plan, so one hot channel pins to one node
  • No sequence number, leaving the client unable to tell a reconnect gap from an ordering swap
  • Optimistic UI with no reconciliation path when the server rejects the write

Learn from primary sources

Practice and explain it back

Realtime chat system

Design a Slack-like chat: 1:1 + channels, presence, delivery + read receipts, offline message queue. Pick the wire protocol and how messages fan out.

Expected evidence: Connection layer + message storage + the fan-out strategy for a 10k-member channel.

Open the interactive drill →

Design exercise: Real-time Application Engineering

WebSockets, server-sent events, presence, synchronization, ordering, reconnects, optimistic UI, and conflict handling. Implement designOutline() returning non-empty values for: connectionLifecycle, ordering, reconciliation. Each value must name a concrete mechanism or decision.

Expected evidence: A design outline with connectionLifecycle, ordering, reconciliation plus an explicit failure mode or trade-off.

Open the interactive drill →

Review prompts

  • Why do WebSockets constrain your load balancer in ways HTTP requests do not?
  • Optimistic UI applies the change locally before the server confirms. What has to be designed for that not to corrupt state?

Build evidence

Synthesize: Distributed Systems

Reason about coordination, data placement, logs, durable workflows, consistency, and recovery under partial failure. Produce one working system, benchmark, or evidence-backed design that integrates the path.

  • Implements or precisely models the core mechanisms from all three milestones
  • Includes at least one injected failure or adversarial case and demonstrates recovery
  • Reports quality, latency, resource, reliability, or usability measurements relevant to the domain
  • Ships a concise architecture note explaining decisions, trade-offs, and remaining risks

Synthesize: Application Engineering

Turn backend, client, UX, real-time, interactive, analytics, and distribution skills into one complete product. Produce one working system, benchmark, or evidence-backed design that integrates the path.

  • Implements or precisely models the core mechanisms from all three milestones
  • Includes at least one injected failure or adversarial case and demonstrates recovery
  • Reports quality, latency, resource, reliability, or usability measurements relevant to the domain
  • Ships a concise architecture note explaining decisions, trade-offs, and remaining risks

Prerequisites

Related concepts

None assigned yet.

Learning paths