Skip to content

5. One service

5. One service

Result: works, but not with gVisor's default networking. The Spanner emulator runs under gVisor and is usable in about 1.2 s, the same as crun. The host can only reach it with gVisor's network=host mode, and the gVisor process tree uses roughly 8× the memory.

Setup (2026-11-22)

  • Image gcr.io/cloud-spanner-emulator/emulator:latest, digest sha256:f9212d99a52ee9bf39b6e4b397eab09b90d87327dca7a985110801456b40dc9d (built 2026-10-14). Distroless: no shell, so probes come from outside (Transpire's Compose file notes the same).
  • Code: spike/service_ready.py. Starts the container with -p 127.0.0.1:19020:9020, polls GET /v1/projects/…/instances from the host every 50 ms until 200 ("live"), then creates an instance and reads it back ("usable", since liveness isn't readiness). Reports the summed VmRSS of the container's process tree from /proc.
  • Rootless Podman 5.4.2 with netavark and pasta.

Raw results

Runtime Live Usable Process-tree RSS
crun (3 runs) 1.18–1.20 s 1.19–1.21 s 52 MiB
runsc, default network=sandbox never (120 s timeout) — —
runsc, network=host (3 runs) 1.16–1.22 s 1.16–1.23 s 407–419 MiB

Isolating the network failure with python3 -m http.server in the uv image:

Runtime Host → published port Inside the container
crun 200 200
runsc, network=sandbox no connection 200
runsc, network=host 200 —

What we learned

  • The emulator itself is fine under gVisor. It started and logged REST server listening at 0.0.0.0:9020 in every mode, and was usable as fast as under crun.
  • Rootless published ports don't reach gVisor's own network stack. With the default network=sandbox, the server answers inside the sandbox but pasta's forwarded connections never arrive. Hypothesis, unverified: pasta delivers published-port traffic on the namespace's loopback, which gVisor's netstack (with its own loopback) never sees.
  • network=host works but weakens the sandbox. gVisor then hands network syscalls to the host kernel, inside the container's own namespace. The job still can't see the host's interfaces, but the host's TCP/IP stack becomes part of the attack surface gVisor was meant to remove.
  • Memory per gVisor sandbox is large. 407–419 MiB measured vs 52 MiB under crun. Not yet explained: the gVisor tree includes the Sentry and its memory file, so RSS may not compare like for like. If it's real, about 350 MiB of overhead per sandbox caps how many emulator-backed jobs smaug can run at once (roughly 17 GB available ÷ ~0.4 GB).

What it changes

  • The runner shouldn't rely on published ports at all. Jobs and their services should share one sandbox network (experiment 6), and logs and results come back over SSH. That avoids the pasta-to-gVisor path entirely.
  • If something must be reached from outside a gVisor sandbox, network=host is a deliberate per-job-type choice, recorded in the job's network policy, never a silent default.
  • Memory per sandbox becomes a scheduling input: a runner advertises how many jobs it can hold, and the per-sandbox overhead needs a proper measurement (gVisor's own metrics, not /proc RSS).