Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 04 · System Design · The parts, properly · about 17 min to read

Play it as a journeyTutor comes with a plan

The customer who won’t hang up (polling, SSE and WebSockets)

Four Systems in One Night
Four Systems in One Night · Open board

Four famous designs worked in one sitting. This lesson opens up the first of them, chat, whose hardest part is not storing messages but getting each one to a person the instant it exists.

Before you start. From The Contract at the Counter (API design): two programs meet at a counter, and every exchange so far was one question, one answer. From TCP vs UDP, and the 3-way handshake and HTTP Keep-Alive: opening a connection (the open line between two computers) costs a round of “hello” messages, and keeping one open saves paying it again. From HTTP 07: Chunked Encoding: a server can send its answer in pieces as they happen. From The order slip rail (queues & the utilization cliff): work that arrives in a bunch hurts far more than the same work spread out.

Lesson 24 of 115 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 13 May 2008: Facebook Chat, and the cost nobody expected
  • The stall’s phone line: polling, asking again and again
  • Hold the line: long polling
  • A line both sides can talk on: the WebSocket
  • A room of people holding phones: the gateway
  • Is anyone still there? The heartbeat
  • Who is on the line right now: presence
  • The power trips: ten thousand callers redial at once

Terms it explains: polling, long polling, WebSocket, gateway, heartbeat, presence, reconnect storm, jitter.

Review System Design