Design a Cloud Coding Workspace
Design a browser-based coding workspace that durably stores repositories around 100 GB, resumes quickly after idle, and safely places isolated workspaces on dedicated or shared execution hosts.
Problem statement
For this exercise, assume an authenticated developer can create or open a personal cloud workspace backed by a logical repository around 100 GB, edit and save files, open or resume an SSH-like interactive terminal, start or cancel a command such as a compilation or test, and watch its output in the browser.
Saved source state and workspace metadata must survive reconnects, idle hibernation, and execution-worker loss.
A resumed workspace must not download or copy the entire repository before it becomes useful: durable manifests and content live independently from compute, while a bounded working set is materialized lazily into a replaceable execution environment.
Every command runs against an immutable source snapshot so replacement compute can reproduce the same input. Support one active editor session per workspace, not simultaneous coauthoring.
The interactive terminal needs authenticated input, ordered output, bounded reconnect, and revocation semantics; a literal SSH wire protocol is not required.
The scheduler may place one workspace alone on a host or multiple users' isolated workspaces on the same host; shared-host placement must enforce CPU, memory, filesystem, process, network, and cache isolation and resist noisy neighbors.
External repository import and version selection may be assumed, but repository hosting, package billing, team permissions, and arbitrary Internet access are outside scope.
Design the public contracts, durable state, large-repository access path, idle lifecycle, isolated compilation path, real-time output path, and recovery behavior.
What to build
- A developer can create or open a workspace backed by a logical repository around 100 GB, browse its source tree, read files on demand, and save file changes durably without materializing the entire repository.
- A developer can start or cancel one isolated compilation, build, or test command against an immutable source snapshot and observe its lifecycle.
- A developer can open, use, disconnect from, and resume an authenticated SSH-like interactive terminal with ordered input and output, and can receive ordered command output and status updates while a command runs.
- A developer can quickly resume after browser loss, idle hibernation, network or gateway interruption, or execution-worker failure without losing acknowledged source saves or accidentally starting the command twice.
At scale
- Assume 50,000 concurrent open workspaces, with peaks of 5,000 workspace opens per second and 20,000 acknowledged file-save operations per second. One execution host may run up to 20 active workspaces belonging to different users, while policy may require dedicated placement for some workloads.
- Target a two-second p95 warm workspace open, a 30-second p95 resume from idle hibernation without full repository materialization, a 300-millisecond p95 save acknowledgement, below 200 milliseconds p95 for interactive terminal input-to-output within one region, and p95 command-output delivery to the browser within one second after a worker produces a chunk.
- Assume a logical repository may be around 100 GB. Durable manifests and content are authoritative, while each editor or compiler receives a bounded demand-materialized working set and an evictable local cache; command output may be retained for 24 hours.
- Target 99.9% control-plane availability and no loss of acknowledged source saves; real-time output may be replayed after reconnect and must not change the authoritative command result.