Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Real-Time Collaborative Pixel Canvas

Design a shared pixel canvas that enforces placement cooldowns, resolves overwrites, and keeps 100,000 connected users converged.

Problem statement

For this exercise, assume authenticated users share one N by M pixel canvas. A user chooses one pixel and one of 15 colors; after an accepted placement, that user cannot place another pixel for five minutes. Another user may overwrite the pixel. Begin with a 100 by 100 canvas supporting at least 100,000 simultaneous users, then evolve the design to 1000 by 1000 pixels. A unique request ID makes retries idempotent: only the first accepted request advances the cooldown, and concurrent accepted writes to one pixel resolve by one authoritative event order whose later event wins. A client loads a compact snapshot with a version cursor, receives current-state deltas while healthy, and can reconnect or resynchronize to reconstruct the current canvas without a permanent state gap. Assume bursts of 10,000 placement attempts per second, up to 300 accepted changes per second sustained, and a two-second p95 visibility target for healthy connected clients. The placement and viewing paths target 99.9 percent monthly availability. Return success only after the placement and cooldown decision are durable; process loss must not lose an acknowledged placement or reopen its cooldown. Design for current-state convergence. Account creation, authentication internals, permanent per-user history, undo, moderation, multiple canvases, and guaranteed delivery of every overwritten intermediate color to a lagging client are out of scope.

What to build

  1. A connected user can load the current canvas, receive current-state deltas while healthy, and use a recoverable cursor or explicit resynchronization to avoid remaining permanently stale.
  2. An authenticated user can idempotently request one valid color at one valid coordinate and receive an accepted result or a precise rejection including remaining cooldown.
  3. Accepted concurrent placements produce one deterministic current color per pixel, with the later placement in the authoritative order overwriting the earlier one.
  4. After disconnect or service-process loss, clients and materializers can reconstruct the current canvas without losing acknowledged placements or weakening cooldown enforcement.

At scale

  • Source requirement: begin with a 100 by 100 grid and evolve to a 1000 by 1000 grid, with exactly 15 available colors and at least 100,000 simultaneous users.
  • Practice assumption: absorb bursts of 10,000 placement attempts per second and sustain up to 300 accepted changes per second while enforcing one accepted placement per user every five minutes.
  • Practice assumption: healthy connected clients observe accepted current-state changes within two seconds at p95, and a reconnecting client can combine a snapshot with catch-up deltas or a newer snapshot without a permanent state gap.
  • Practice assumption: the placement and viewing paths target 99.9 percent monthly availability, and an acknowledged placement plus its cooldown survives process loss.