← mohithgajjela.com
SYSTEM / 02
MOHITH GAJJELA
RECORDED DEMO
replays, not live traffic
SYSTEM 02 / SWITCHYARD

A Go web gateway,
tested by breaking it.

It sits in front of a website, routes requests, caches pages and stops one failure from spreading. Each replay below runs the same traffic twice, with one safety feature off and then on.

edge proxy · 5 cache nodes · 3 origins · Go standard library only · 61 testseverything below was recorded on one laptop · nothing on this page is handling traffic
CONSISTENT HASHING + REQUEST COALESCING + RETRY BUDGETS + CIRCUIT BREAKERS + LOAD SHEDDING + SOCKET HANDOFF + CONSISTENT HASHING + REQUEST COALESCING + RETRY BUDGETS + CIRCUIT BREAKERS + LOAD SHEDDING + SOCKET HANDOFF +
01THE EXPERIMENTS · SIX RECORDED A/B RUNS

Same traffic, twice.
One mechanism off, then on.

The traffic follows real Wikipedia page popularity. Partway through, something breaks: a cache node crashes, a page goes viral, or the server slows down.

RECORDED DEMO

These are recordings from 30 Sep 2026, not a live gateway. The working code is on GitHub.

WHAT THE REPO DOES

0.0s / 0s
  served from cache went to the origin failed turned away fast OPEN = circuit breaker open
REPLAYrecorded withoutwithdashed lines are injected events
MEASURED RESULT

02RESULTS · ALL SIX, MEASURED NOT TYPED

What each mechanism
actually prevented.

One number per experiment, each the difference between the two recorded runs. Every value on this page is read out of the recorded data when the page loads.

03THE REAL THING · THIS PAGE IS A REPLAY

This page is a replay.
The repo is a working gateway.

These experiments can't run in a browser tab: they need real processes crashing, real sockets and real signals. So the page plays back recordings. The code that produced them is on GitHub, where it builds, passes its tests on every push, and runs in front of ordinary HTTP servers.

01 · WHAT'S IN THE REPO

One binary, five roles.

  • edge, cache, origin, loadgen and lab, all in one Go program with no dependencies outside the standard library.
  • 61 tests, including tests that start the real binary as its own process and send it real SIGHUP and SIGUSR2 signals.
  • CI on every push runs the suite under the race detector on Linux, the benchmarks, a shortened lab run, a Docker Compose stack, and the example below.
02 · WHERE IT WORKS

Linux or macOS, any HTTP backend.

  • Go 1.23+ or Docker. Tested on Apple Silicon macOS and on Ubuntu x86-64 in CI.
  • In front of any plain-HTTP server. It caches GET responses that send Cache-Control: max-age, passes everything else straight through, and never shares a cached response between requests that carry cookies or an Authorization header.
  • Checked against a server that isn't mine: examples/front-a-python-server.sh fronts a ten-line Python server, kills a cache node, and restarts the edge during 400 requests. All 400 return 200.
  • lab run re-records every number on this page in about seven minutes.
03 · WHERE IT DOESN'T

Not a production CDN.

  • No HTTPS. No TLS termination, no TLS to the origin, HTTP/1.1 only.
  • One edge instance. Rate and concurrency limits are per process, not shared across a fleet.
  • A simple cache: in memory, sized by entry count, empty after a restart.
  • No Windows. Restarts rely on Unix signals and file-descriptor passing.
# the lab, with the same experiments and a Run live button git clone https://github.com/Mohith26/switchyard && cd switchyard go run ./cmd/switchyard lab serve # the whole topology: 3 origins, 3 cache nodes, 1 edge on :8080 docker compose up --build # in front of a server that isn't Switchyard's ./examples/front-a-python-server.sh
04LIMITS · STATED PLAINLY

What this page cannot
claim.

01

One machine, over loopback.

Every run happened on one laptop, so there is no real network latency or packet loss and the throughput is laptop-scale. The numbers show how much each mechanism changes the outcome, not how an internet-facing deployment would perform.

02

The origin is simulated.

Three origins with sixteen workers each, a bounded queue and lognormal service times, about 2,300 requests a second in total. Like most real backends it keeps working on requests their callers have abandoned, which is what makes the retry storm self-sustaining. Its parameters are in the repo.

03

Breakers don't create capacity.

While the origin was four times slower, both sides served very little: 3% without the breakers and 7% with them. The difference is what happened afterwards. One side recovered half a second after the origin did. The other never recovered.

04

These are standard techniques.

Consistent hashing, request coalescing, retry budgets and socket handoff all come from how existing CDNs and proxies work. What is mine is the from-scratch implementation, the experiments, and two bugs I found while measuring it. Nobody should deploy this instead of Envoy.

Home