Build a Pausable GPU Workspace Platform for Research Teams
System DesignModel answerLast updated
Design a service that hands out isolated, GPU-backed Jupyter-style workspaces that can be started, paused, and resumed on any host without losing files or packages, while controlling idle GPU spend.
Problem
Your company wants an internal platform where machine learning engineers can request a personal compute workspace with one or more GPUs attached. The workspace runs a Jupyter-style notebook server. The engineer opens it in a browser, trains models and analyzes data, pauses it when they step away, and later resumes it with their files and installed packages exactly as they left them.
Design this platform end to end.
Things to settle up front
No scale, latency, or cost numbers are provided. State your own assumptions explicitly, for example:
- The number of engineers and the peak count of concurrent workspaces.
- The GPU types and counts a single workspace can request, and whether they can change after creation.
- Target time for a new workspace to become usable, and for a paused one to resume. Is a short queue acceptable when no matching GPU is free?
- What must survive a pause: only files, or also installed packages, background processes, and open terminals?
- Whether workspaces start from a base image plus a setup spec, or start blank.
- What counts as "idle" for automatic pausing: no browser connection, no GPU activity, or both.
Fixed requirements
- Workspaces execute arbitrary user code, so each must be isolated from other workspaces and from the platform's control plane.
- A workspace is stateful and long-lived. It may hold days of unsaved notebook state, installed libraries, large datasets, and model checkpoints.
- GPUs are scarce and expensive. Idle GPU-backed workspaces must not consume budget indefinitely.
What to cover
- The workspace lifecycle: states, valid transitions, and the API surface.
- A latency budget for create and resume, and which steps can be prepared ahead of time.
- Storage that survives pause/resume and, ideally, host failure.
- How a browser reaches a workspace that may come back on a different machine.
- An idle-detection and auto-pause policy, and its cost versus user-experience trade-off.
- Isolation between workspaces and between workspaces and the control plane.
Hints
Hint 1
Separate what must be durable (files, installed packages, checkpoints) from what can be thrown away (the host, the container). If compute is disposable, resuming on a different machine stops being a special case.
Hint 2
Users should never hold a host address. Put a stable per-workspace endpoint in front, backed by a routing table the scheduler updates whenever a workspace is placed or moved.
Hint 3
Break startup into steps (image pull, GPU selection, volume attach, container start, connection) and ask which can be done before the user clicks. Pre-warmed images and a per-host free-GPU inventory remove most of the wait.
Hint 4
For idle detection, GPU utilization is a better signal of waste than an open browser tab. Pair any auto-pause with an advance warning and one-click resume.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Assumptions
- About 5,000 engineers, with a few thousand workspaces running at peak.
- A workspace asks for one GPU type and count at creation, from a small catalog (a single mid-range GPU up to an 8-GPU node). This is fixed for its lifetime. To change GPU count, create a new workspace on the same persistent volume rather than resizing live.
- Targets: roughly 1 minute for a warm resume, 2-3 minutes for a cold create that must pull an image. If no matching GPU is free, the request queues and the user sees their position and an estimate.
- Preserved across pause: files, installed packages, checkpoints, shell history. Not preserved by default: running processes and open terminals.
Lifecycle and API
States: CREATING -> RUNNING -> PAUSING -> PAUSED -> RESUMING -> RUNNING -> DELETING -> DELETED. A FAILED state is reachable from any transitional state (host loss, scheduling timeout). Failure never touches the volume, so the user can retry a resume on another host.
POST /workspaces {gpu_type, gpu_count, image, setup_script} -> {id}
GET /workspaces/{id} -> {state, connect_url, gpu_type, ...}
POST /workspaces/{id}/pause
POST /workspaces/{id}/resume
DELETE /workspaces/{id}
Operations are asynchronous and idempotent. A control-plane service stores desired state, and reconcilers drive actual state toward it. This makes retries and crash recovery safe. Transitions are guarded so, for example, resume on a RUNNING workspace is a no-op.
Durable state versus disposable compute
All durable data lives on a network-attached persistent volume owned by the workspace, not on host disks. This includes notebooks, checkpoints, and the installed-package layer (kept as a writable filesystem layer on top of the base image, so packages are not reinstalled on each resume).
- Pause: stop the container, release the GPU, detach the volume but keep it.
- Resume: the scheduler picks any host with a free GPU of the right type, attaches the volume, and starts the container from base image plus volume layer.
Because placement is arbitrary, host failure and pause/resume use the same code path. Replicate the volume (or use a storage system with built-in replication) and take periodic snapshots for protection against corruption or accidental deletion. Large shared datasets should sit in a separate read-mostly store or cache rather than in every user's volume.
Running processes are lost on pause. Users must checkpoint training state themselves. Process-level checkpointing (CRIU-style, plus GPU state) is possible for narrow cases but is complex and fragile, so treat it as a later enhancement.
Latency budget
Cold create steps:
- Pull the base image if not on the host.
- Choose a host and reserve a GPU.
- Attach the volume.
- Start the container and notebook server.
- Register the route and open the connection.
Steps 1 and 2 dominate. Mitigations:
- Pre-pull popular base images onto every GPU host, and keep image layers small and shared.
- Maintain a per-host free-GPU inventory so scheduling is a lookup, not a scan. Use bin-packing to keep whole multi-GPU hosts free for large requests.
- A warm resume skips the pull if the image is cached and skips volume creation entirely.
- Optionally keep a small pool of pre-initialized containers for the most common configuration.
Routing
Browsers connect to a stable endpoint such as wss://gateway/workspaces/{id}. The gateway authenticates the user, looks up the workspace's current host in a routing table, and proxies HTTP and WebSocket traffic. The scheduler updates the table on every placement change. The user's identity for a workspace is decoupled from its physical location, so a move after resume is invisible apart from a reconnect. Gateways are stateless and horizontally scalable, and the routing table lives in a replicated store with short caching.
Isolation
- Each workspace runs in its own container, or a microVM (such as Firecracker) for stronger separation against hostile code, with its own network namespace and a non-root user.
- GPUs are assigned exclusively, never shared between workspaces by default.
- Volumes are mountable only by their owning workspace.
- Network policy denies access to the control plane's internal APIs and to other workspaces. Outbound traffic goes through an egress proxy that can rate-limit, log, and block.
- The control plane and workspace hosts use separate credentials, and workspaces receive only short-lived, scoped tokens.
Idle cost control
GPU time is the cost driver, so weight GPU utilization above connection presence:
- Mark a workspace idle when GPU utilization and kernel activity stay near zero for a threshold (for example 30-60 minutes), even if a browser tab is open.
- Do not pause a workspace with active GPU use even if the browser disconnected, since long training runs are a primary use case.
- Send a warning (in the UI and by notification) before pausing, allow "keep alive" extensions up to a cap, and offer one-click resume.
- Add quotas, per-team budgets, and a maximum paused lifetime after which volumes are archived to cheaper storage and eventually deleted with notice.
Trade-off: a short threshold saves money but frustrates users who lose process state, while a long one wastes GPU hours. Making thresholds configurable per team and being transparent works better than a single global value.
Trade-offs and common mistakes
- Not preserving processes trades user convenience for simplicity and lower cost.
- Arbitrary-host resume requires the volume-plus-gateway design, but it makes failures routine rather than exceptional. A sticky-host model is simpler but leaves users stuck whenever their host is busy or broken.
- Common mistakes: storing state on host disks, handing out host IPs, ignoring the GPU-availability wait case, treating "browser connected" as "in use", and forgetting isolation between tenants running arbitrary code.
- Also consider observability (time-to-ready per step, queue wait, GPU utilization per workspace) so you can see where latency and waste actually come from.