HomeCase studiesIsolated Go Sandbox and Technical Coding Practice...

Case study · Warsaw, Poland

Isolated Go Sandbox and Technical Coding Practice Platform

Technical Assessment & Sandbox Execution

Interactive programming platforms fail when untrusted user code can starve shared CPU resources, escape container boundaries, or produce inconsistent test verdicts under load. We engineered a coding practice and assessment platform powered by a React browser IDE, a high-concurrency Go execution coordinator, gVisor-isolated sandboxes, Redis Streams, and PostgreSQL. The system compiles and evaluates multi-language submissions deterministically against hidden test suites while streaming live compiler diagnostics and memory telemetry back to learners.

Industry
Technical Assessment & Sandbox Execution
Solution
A browser-based coding practice and technical assessment platform built with React, Go, gVisor sandboxes, and PostgreSQL for deterministic, isolated multi-language code evaluation.
Platforms
Web & API
Stack
React · TypeScript · Go · PostgreSQL · Redis · Docker
Location
Warsaw, Poland · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Warsaw, Poland. Names withheld by agreement.

Project Overview

Evaluating software engineering skill demands executing real code, not parsing multiple-choice syntax trivia. Whether a learner is practicing graph traversal algorithms or completing a timed backend debugging task, the browser IDE must behave like a responsive local terminal while protecting shared infrastructure from infinite loops, memory leaks, and deliberate sandbox probing. Standard container setups alone leave too much host kernel attack surface exposed when executing arbitrary code submitted from the public internet.

We built a coding practice and technical assessment platform anchored by a React editor workspace, a Go execution control plane, gVisor-sandboxed worker nodes, Redis Streams, and PostgreSQL. The architecture turns untrusted source submissions into reproducible compile-and-test pipelines with real-time diagnostic feedback.

Business Bottleneck

Earlier prototype evaluation loops struggled once usage expanded beyond small internal groups:

  • Shared-host interference: Concurrent C++ or JVM compilations degraded execution timing for neighboring submissions, turning clean solutions into spurious timeout failures.
  • Unbounded stdout flooding: Tight print loops generated multi-megabyte log payloads that stalled browser tabs and bloated database rows.
  • Unsafe kernel exposure: Running untrusted binaries under default Docker configurations exposed host syscalls and internal metadata endpoints if misconfigured.
  • Opaque submission failures: Learners could not distinguish syntax errors, runtime panics, memory-limit kills, and failed hidden assertions without clear stage-by-stage reporting.

Architectural Strategy

Our guiding principle was decoupling interactive editing from isolated, resource-pinned execution. The React frontend manages syntax highlighting, local draft persistence, and sample test inspection, submitting code payloads over HTTPS to the Go API server. Instead of spawning containers inline within HTTP handlers, the Go service persists an immutable submission record in PostgreSQL, enqueues a typed execution job onto Redis Streams, and immediately subscribes the client's WebSocket connection to live progress events.

Dedicated Go runner daemons on stateless worker nodes pull jobs based on available CPU cores, spin up pre-warmed or ephemeral gVisor (runsc) sandboxes, apply strict cgroups v2 ceilings, and publish structured verdicts—compilation status, per-testcase runtime, peak RSS memory, and truncated diffs—back through Redis Pub/Sub.

Core Capabilities

  • Multi-Language Browser IDE: React + Monaco workspace featuring split problem statements, custom stdin scratchpads, keyboard shortcuts, and automatic draft recovery.
  • Two-Stage Compile & Test Pipeline: Separates compilation diagnostics from per-testcase runtime enforcement so learners see exact compiler errors before test execution begins.
  • Deterministic Resource Metering: Captures wall-clock latency, user CPU time, and peak resident memory per test case within isolated cgroup boundaries.
  • Versioned Problem & Harness Authoring: Problem setters define public samples, hidden edge-case suites, time/memory budgets, and custom output checkers under immutable revision hashes.
  • Cohort & Replay Inspection: Mentors and hiring reviewers step through submission timelines, code diffs, and execution verdicts side by side.

Technical Architecture

Submissions enter the Go API layer, where request middleware enforces JWT identity and per-user token-bucket rate limits in Redis. After storing source text and the active problem revision ID in PostgreSQL, the API pushes a job payload onto a consumer-group Redis Stream partitioned by language runtime so heavy toolchains do not starve lightweight interpreters.

Flow: React Monaco IDE → Go API Gateway (Auth & Rate Limit) → PostgreSQL (Submission Ledger) + Redis Streams → Go Runner Daemon → gVisor (runsc) Sandbox (No Network, cgroups v2) → Redis Pub/Sub → WebSocket Verdict Stream

Inside each worker node, a Go supervisor prepares an isolated scratch mount with read-only test inputs, runs compilation under a generous build ceiling, and then iterates test cases against the compiled artifact using tight per-case timers. Output pipes stream through ring-buffered readers capped at a few kilobytes per test case so runaway printf loops fail safely without exhausting worker RAM.

Technology Stack

Category Technology detail
Browser IDE Frontend React + TypeScript with Monaco Editor and incremental output streaming
API & Judge Coordinator Go (net/http, chi router, gRPC worker dispatch, WebSocket hub)
Sandbox Runtime Docker containers hardened with gVisor (runsc), cgroups v2, and seccomp
Queue & Real-Time Pub/Sub Redis Streams for job backpressure and Pub/Sub for live verdict streaming
Primary Database PostgreSQL storing versioned problems, test harnesses, and submission logs
Artifact Storage S3-compatible object store for large test fixtures and archived stdout logs
Language Toolchains Pre-baked immutable base images for Go, Python, Java, C++, and Node.js
Telemetry & Metrics Prometheus and structured Go runtime tracing for sandbox queue depth

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Eliminating host-kernel exploit vectors from arbitrary code Selected gVisor (runsc) user-space kernel virtualization over standard runc; introduces slight syscall overhead for I/O-heavy scripts while dramatically reducing host kernel exposure.
Avoiding noisy-neighbor timing skew across concurrent runs Pinned worker concurrency to physical CPU core counts and enforced per-sandbox cgroups v2 CPU/memory isolation; reduces max packing density per VM in exchange for consistent latency readings.
Preventing massive stdout dumps from crashing PostgreSQL or React Applied Go ring-buffer truncation on container output streams and stored only bounded previews in PostgreSQL, offloading oversized raw fixture comparisons to object storage.
Handling WebSocket drops during long-running compilation queues Backed verdict delivery with PostgreSQL status persistence plus Redis Pub/Sub; if a browser reconnects mid-run, React fetches the latest checkpoint from REST and resumes live updates.

Security & Reliability

Every sandbox executes with zero network access (--network=none), dropped Linux capabilities, read-only language toolchain layers, and strict pids.max caps to neutralize fork bombs before they reach the scheduler. Worker nodes sit inside isolated VPC subnets without access to production PostgreSQL credentials or internal object-store write keys; only the Go runner supervisor retrieves problem fixtures from cache and hands mounted inputs to the container.

At the API perimeter, Redis sliding-window limiters throttle burst submissions per account, and problem-authoring endpoints strictly separate hidden test payloads from learner-facing GraphQL/REST projections so test answers never leak into browser network responses.

Performance & Scale

Cold container creation can dominate latency for sub-second Python or Go exercises. To keep feedback crisp, worker daemons maintain warm language-runtime rootfs caches locally on NVMe volumes and pre-compile standard library headers inside immutable base images. Separating interactive "Run Sample" requests onto a high-priority Redis Stream ahead of bulk "Rejudge Cohort" batch jobs prevents instructor batch operations from stalling active learners.

PostgreSQL tables partition high-volume submission telemetry separately from problem definitions and user profiles, using composite indexes on (user_id, problem_id, created_at) so profile histories and leaderboard queries stay responsive as submission counts climb.

Operational Outcomes

Combining Go's predictable concurrency model with gVisor isolation and PostgreSQL revision tracking created an assessment engine capable of handling bursty classroom and interview traffic cleanly:

  • Trustworthy execution verdicts: CPU pinning and cgroups isolation eliminated spurious timeouts caused by noisy neighboring submissions.
  • Hardened multi-tenant execution: Disabling container networking and intercepting syscalls through gVisor kept untrusted candidate code strictly contained.
  • Responsive authoring workflows: Problem setters validate edge-case suites and custom checkers against historical solutions before publishing new problem revisions.
  • Resilient queue behavior: Redis Streams consumer groups absorb workshop spikes gracefully, preserving submission order and delivering live incremental feedback to the React IDE.

01 — Questions

asked about this kind of project

How do you stop malicious submissions from breaking out of the container or scanning internal networks?

Every submission runs inside an ephemeral container backed by the gVisor user-space kernel rather than sharing the host Linux kernel directly. Network interfaces are completely disabled, root filesystems are mounted read-only except for a tiny tmpfs scratch directory, and non-root UIDs execute user code.

Why choose Go for the judge coordinator instead of a scripting runtime?

Go's lightweight goroutines and deterministic memory footprint allow a single coordinator binary to multiplex thousands of open WebSocket streams, supervise container lifecycles, enforce sub-second execution timeouts, and stream bounded stdout chunks without garbage-collection pauses.

How do you prevent fork bombs or memory exhaustion from crashing sibling submissions?

Before invoking a compiler or binary, the Go runner configures strict Linux cgroups v2 quotas covering PID counts, RAM ceiling, CPU shares, and output byte caps. Any process crossing its memory or PID ceiling is terminated immediately and tagged with a clear resource-limit verdict.

How are floating-point or multi-valid-answer problems graded accurately?

Problem authors attach either exact normalized diffing or custom Go/Python checker binaries to each problem version. When custom checkers run, they execute in a separate sandbox pass against the candidate's read-only output artifact.

What happens when a problem author updates test cases after learners have already submitted solutions?

Problem specifications and test suites are immutably versioned in PostgreSQL. Existing submissions remain tied to the exact problem revision hash they ran against, while re-judging cohorts runs asynchronously as a low-priority background stream.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.