← Meta Interview Insights

Meta·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Apr 2026

Summary

Meta SWE system design round focused entirely on building an online code judge with a contest leaderboard. Two distinct halves to the problem and apparently very easy to run out of time on the leaderboard portion if you get sucked into schema details early on.

Questions Asked (4)

Q1

Design an online code judge system with a contest leaderboard, covering sandbox execution, the judging pipeline, and real-time leaderboard updates.

System DesignTechnical Trade-offsData Modeling
Author's notes

The time split is what kills people here, myself included.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then break the system into three core components: sandboxed execution, judging pipeline, and real-time leaderboard. For each component, discuss design choices, trade-offs, and how they integrate to handle high concurrency and low latency.

Pro tip: Emphasize security and isolation in the sandbox, and discuss how you would handle malicious code and resource limits. Also, highlight the importance of idempotency and exactly-once processing in the judging pipeline to avoid duplicate submissions.

1. Clarify Requirements and Scale

Ask about expected number of users, submissions per second, contest duration, and latency requirements. Define functional and non-functional requirements.

2. Design Sandbox Execution

Choose isolation technology (containers, VMs, gVisor) and discuss resource limits (CPU, memory, time), security, and how to handle different languages.

3. Design Judging Pipeline

Outline the flow from submission to result: queue, workers, compilation, execution, test case validation, and result storage. Discuss scalability, fault tolerance, and idempotency.

4. Design Real-Time Leaderboard

Choose data stores (e.g., Redis sorted sets) and update mechanisms (pub/sub, WebSockets) to provide low-latency updates. Discuss consistency and ranking algorithms.

5. Address Trade-offs and Integration

Discuss trade-offs between consistency and availability, cost, and complexity. Explain how components interact and handle failures.

Key Points to Mention

  • Sandbox isolation techniques (containers, gVisor, Firecracker) and resource limiting (cgroups, seccomp).
  • Judging pipeline scalability using message queues (Kafka, RabbitMQ) and worker pools.
  • Idempotency and exactly-once processing to handle retries and duplicate submissions.
  • Real-time leaderboard using Redis sorted sets and WebSocket for push updates.
  • Trade-offs between strong consistency and low latency in leaderboard updates.
  • Security considerations: preventing code injection, resource exhaustion, and network access.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

How does Docker actually execute submitted code in this system? Walk through container startup, filesystem isolation, and resource limiting.

System DesignTechnical Trade-offs
Author's notes

Came up as a follow-up and I was not as crisp as I wanted to be.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer as a logical pipeline: first explain how the Docker daemon receives the code and creates a container, then detail the Linux primitives (namespaces, cgroups, UnionFS) that provide isolation and resource limits, and finally discuss trade-offs like security and performance. Use concrete examples of how each layer contributes to safe, efficient execution.

Pro tip: Emphasize that Docker is not a lightweight VM but a process-level isolation tool built on Linux kernel features; this shows depth and avoids common misconceptions. Also, mention that while Docker provides strong isolation, additional sandboxing (e.g., gVisor, seccomp) is often needed for untrusted code.

1. Container Startup

Describe how the Docker daemon receives a request to run code, pulls or uses an existing image, and creates a container by invoking runc, which sets up the container environment and starts the process.

2. Filesystem Isolation

Explain how Docker uses UnionFS (e.g., OverlayFS) to create a layered, copy-on-write filesystem for the container, and how mount namespaces ensure the container sees only its own filesystem.

3. Resource Limiting

Detail how cgroups (control groups) limit CPU, memory, disk I/O, and network bandwidth for the container, and how these limits are enforced by the kernel.

4. Security and Trade-offs

Discuss additional isolation mechanisms like seccomp, AppArmor, and capabilities, and trade-offs between isolation strength, performance overhead, and complexity.

Key Points to Mention

  • Docker daemon and containerd/runc architecture
  • Linux namespaces (PID, mount, network, UTS, IPC, user) for isolation
  • UnionFS (OverlayFS) for layered filesystem and copy-on-write
  • cgroups for resource limiting (CPU, memory, I/O)
  • Security features: seccomp, AppArmor, capabilities, and user namespaces
  • Trade-offs: performance overhead, isolation strength, and need for additional sandboxing for untrusted code

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

How would you adapt the leaderboard if instead of a global ranking you only need to show a user's friends in the top 10?

System DesignProduct Sense & Ideation
Author's notes

Honestly a nicer variant of the problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: the leaderboard is scoped to a user's friends, and we only need the top 10. Then, discuss how to efficiently compute and maintain this ranking, considering data partitioning, query patterns, and update frequency. Finally, address trade-offs between precomputation and on-demand computation, and how to handle scale.

Pro tip: Emphasize that the friend graph is dynamic and the leaderboard must be personalized, so caching per user may be expensive; consider a hybrid approach where you precompute friend scores periodically and merge with real-time updates. Also, mention that you'd validate the design with back-of-the-envelope calculations for read/write QPS and storage.

1. Clarify Requirements

Confirm that the leaderboard is per-user, showing only friends' scores, and only the top 10. Ask about update frequency, consistency requirements, and scale (number of users, average friends).

2. Data Modeling

Decide how to store scores and friend relationships. Consider a graph store for friendships and a sorted set (e.g., Redis ZSET) per user for friend scores, or a global score store with efficient friend filtering.

3. Computation Strategy

Evaluate options: on-demand computation (fetch friends' scores and sort) vs. precomputed per-user leaderboards. Discuss trade-offs in latency, cost, and freshness. For top 10, a heap or partial sort can optimize.

4. Scalability & Updates

Address how to handle score updates and friend changes. Consider incremental updates to precomputed lists, or a pub/sub system to notify affected users. Discuss sharding and caching strategies.

5. Trade-offs & Optimizations

Summarize trade-offs and propose a hybrid approach: precompute friend scores periodically and merge with real-time updates for active users. Mention monitoring and fallback mechanisms.

Key Points to Mention

  • Friend graph partitioning and efficient retrieval of friends' scores
  • Use of sorted data structures (e.g., Redis ZSET, heaps) for top-K queries
  • Precomputation vs. on-demand computation trade-offs (latency, cost, freshness)
  • Handling dynamic updates: score changes and friend list changes
  • Caching strategies and invalidation for personalized leaderboards
  • Back-of-the-envelope calculations for scale (QPS, storage, network)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Compare different sandboxing approaches for running untrusted code: gVisor, Firecracker, and nsjail. What are the tradeoffs?

Technical Trade-offsSystem Design
Author's notes

They pushed on this after I mentioned Docker.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the core isolation requirements and threat model for running untrusted code, then compare gVisor, Firecracker, and nsjail across dimensions like isolation strength, performance overhead, and operational complexity. Conclude with a recommendation tied to specific use cases, acknowledging that the right choice depends on the tradeoff between security and efficiency.

Pro tip: Emphasize that these technologies operate at different layers—nsjail uses OS-level namespaces, gVisor intercepts syscalls in userspace, and Firecracker leverages hardware virtualization—so they are not mutually exclusive and can be combined for defense in depth.

1. Clarify requirements and threat model

Ask or state the assumptions: what kind of untrusted code, what attack vectors (e.g., container escapes, side channels), and performance/latency constraints. This frames the comparison.

2. Explain each approach's mechanism

Briefly describe how nsjail (namespaces/seccomp), gVisor (user-space kernel), and Firecracker (microVM with KVM) isolate workloads, highlighting their layer of operation.

3. Compare across key dimensions

Evaluate isolation strength, performance overhead (CPU, memory, I/O), startup latency, compatibility, and operational complexity. Use concrete examples or benchmarks if possible.

4. Discuss tradeoffs and use cases

Map each technology to scenarios: nsjail for lightweight, trusted-ish code; gVisor for stronger syscall isolation with moderate overhead; Firecracker for strong VM-level isolation with near-native performance.

5. Recommend and justify

Give a clear recommendation based on the stated requirements, and mention that combining approaches (e.g., gVisor inside Firecracker) can provide layered security.

Key Points to Mention

  • Isolation level: nsjail uses Linux namespaces and seccomp (process-level), gVisor implements a user-space kernel (syscall interception), Firecracker uses KVM-based microVMs (hardware virtualization).
  • Performance overhead: nsjail is lowest, gVisor adds syscall and I/O overhead, Firecracker has near-native CPU but higher memory footprint and startup time.
  • Startup latency: nsjail is milliseconds, gVisor is similar to containers, Firecracker can be ~125ms but still slower than containers.
  • Compatibility: nsjail and gVisor may have issues with certain syscalls or features; Firecracker runs a full kernel so compatibility is high.
  • Security guarantees: Firecracker provides strongest isolation (VM boundary), gVisor reduces kernel attack surface, nsjail relies on kernel security and is weakest if misconfigured.
  • Operational complexity: nsjail is simplest to deploy, gVisor requires runsc integration, Firecracker needs VM image management and networking setup.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.