Skip to content

12. Job on tailcat

12. Job on tailcat

Added after #11 when Gavin asked whether jobs could join the tailcat network without it being too expensive, on apple/container in particular.

Result: cheap in memory, slow to start until DNS is fixed. A tailcat endpoint inside a job's VM adds about 24 MB to the VM's host footprint. It takes about 6 s to come up, because apple/container's DNS forwarder ignores a new VM for its first ~2.5 s and Go's resolver then waits 5 s to retry. With the VM pointed at a working resolver it is up about 0.5 s after boot. Separately: every job VM can reach the Mac's whole tailnet.

Setup (2026-11-22)

  • tailcat v0.7.0 linux_arm64 release tarball, checked against the release's checksums.txt, kept in spike/.cache/ (git-ignored) and mounted into the container read-only at /tc.
  • spike/macos_tailcat_cost.py: per run, one idle alpine VM and one running tailcat serve --key new --json 19999; time until listenAddr appears in the logs, tailcat's VmRSS in the guest, footprint of both VMs on the host. Three runs.
  • On smaug's host (no sandbox) for reference: the same tailcat serve, three times.
  • Diagnosis by hand: tailcat --verbose, timed DNS and TCP probes from inside fresh VMs, and --dns set to the Mac's first resolver (100.100.100.100, the Mac's Tailscale DNS).

Raw results

Where Ready (s) tailcat memory VM host footprint, idle → with tailcat
smaug host 0.79, 0.21, 0.21 23.4–23.7 MiB RSS, 11–14 threads —
apple/container, default DNS 6.12, 6.08, 6.05 (from container run) 20.9–21.1 MiB RSS 288 → 311–313 MB
apple/container, --dns 100.100.100.100 0.77–0.90 after VM boot not measured not measured

Inside a fresh VM:

  • tailcat prints nothing for its first 5.3 s; then STUN probes, relay selection and listening all finish within 0.2 s.
  • The first DNS lookup through apple/container's forwarder (192.168.64.1) always takes 2.52 s, then lookups are instant. Raw DNS queries sent every 0.1 s from boot first get an answer at 2.22–2.55 s uptime. An outbound TCP connection to 1.1.1.1 succeeds at 0.31 s uptime, first try.
  • With --dns-option timeout:1, tailcat gives up and exits: Go's two 1-second attempts both land in the forwarder's dead window.
  • tailcat warns it can't raise its UDP buffer sizes inside the VM ("impacts throughput"). Throughput wasn't measured.
  • From a job VM, TCP to smaug's tailnet address (100.97.207.72:22) and to the Mac's Tailscale DNS (100.100.100.100:53) both connect.

What we learned

  • Memory isn't the obstacle. ~21 MiB per endpoint inside the job, ~24 MB on the Mac's side; small next to the VM's own ~290 MB, and the same order as on Linux.
  • Start-up is, but it's apple/container's DNS, not tailcat. Every job that looks up a name in its first ~2.5 s pays for it (2.5 s with musl's resolver, 5 s with Go's). That hits more than tailcat: uv, pip and test suites fetching anything at start. Giving the VM a resolver that answers immediately removes it. I don't know why the forwarder is slow; it may be worth an upstream issue.
  • A job VM reaches everything the Mac reaches, including its tailnet. apple/container NATs VM traffic through the Mac, so a job could reach smaug's SSH or any other tailnet or LAN service. The job network policy item is urgent on macOS, not just Linux (where it is still unverified).
  • tailcat still uses the public tailcat.dev DERP map and a San Francisco relay here. (Gavin, after the design review: v1 doesn't need its own relay; the default is fine to start.)

What it changes

  • Whether jobs should be tailcat endpoints at all is a design question, not a cost question: it costs ~20 MiB and well under a second when DNS works. The design has to say what a job would use it for, and what holding a tailcat key inside a sandbox exposes.
  • The macOS backend sets each VM's DNS itself rather than relying on apple/container's forwarder.
  • Job network policy moves up: on macOS a job needs its outbound traffic restricted, or the owner's tailnet and LAN are open to it.