KatInterview

Design a Scalable Multi-Tenant Cloud Development Environment

System DesignModel answer
MediumModel answerSystem Designsystem-designmulti-tenancysandboxing

Last updated

Architect a cloud IDE platform with hardware-level sandbox isolation, sub-100ms real-time document collaboration, and multi-tenant resource limits.

Architect a multi-tenant cloud development platform (similar to Replit or GitHub Codespaces) where software developers can write, build, collaborate on, and execute arbitrary code in their browser.

Requirements

Functional

  1. Workspace Management: Users can instantiate, pause, resume, and terminate isolated software development environments.
  2. Real-time Collaboration: Multiple developers can edit the same files simultaneously with low latency.
  3. Arbitrary Code Execution: Environments must support running untrusted shell sessions, compilers, build systems, and long-running services (e.g., local web servers).
  4. State Persistence: File modifications must persist across workspace restarts and host failures.

Non-Functional & Constraints

  1. Security & Tenant Isolation: Absolute boundary between tenants. A user running root inside their environment must not access host memory, inspect other tenants' code, or jeopardize the host system.
  2. Performance: Keystroke propagation latency must remain sub-100ms. Workspace cold-start time should remain under 5 seconds.
  3. Resource Efficiency: Support high density per physical bare-metal node while preventing noisy-neighbor issues through strict resource quotas (CPU, RAM, Disk I/O, Network).
  4. Scale: Support 20,000 active concurrent interactive sessions.

Key Topics to Cover

  • Capacity Planning & Sizing: Define traffic patterns, storage overhead, and fleet sizing.
  • System Architecture & Control Plane: End-to-end design from browser traffic routing to workspace orchestration.
  • Runtime Isolation Strategy: Trade-offs between containers, userspace kernels, and microVMs.
  • Storage & Collaborative File Synchronization: Architecture for real-time document synchronization (CRDT/OT) integrated with persistent storage.
  • Resource Management & Lifecycle: Tenant quota enforcement, overcommit strategies, and idle workspace handling.

Hints

Hint 1

Consider how traditional Linux container isolation (namespaces/cgroups) falls short when users are given root access to run untrusted code.

Hint 2

For collaborative editing, evaluate whether operational transformation (OT) or Conflict-free Replicated Data Types (CRDTs) fit better in a system where the workspace filesystem also changes via shell tools (e.g., git).

Hint 3

Think about workspace cold-start performance: how can snapshotting or pre-warmed virtual machine pools meet a <5 second startup budget?