Anatomy of a Sub-Millisecond WebAssembly Component Cold Start
Breaking down every microsecond between TLS ALPN negotiation, `mmap` code-page faults, linear memory copy-on-write snapshots, and WASI Preview 2 host call trampolines.

Principal Systems Architect · Stockholm

Marketing benchmarks love quoting 50 µs isolate instantiation numbers measured in a tight loop with hot L2 instruction caches. Real multi-tenant edge nodes evict cold tenant artifacts to NVMe every few minutes. When a request lands in Frankfurt for a worker untouched since yesterday, the kernel page table—not your JIT compiler—dominates time to first byte.
Where the 840 Microseconds Actually Go
We instrumented an ahead-of-time compiled Wasmtime embedder serving 4,200 distinct tenant components on a 64-core EPYC host. Under Zipfian request traffic, median instantiation took 310 µs, while p99 climbed to 2.9 ms until we separated read-only .text segments from pre-initialized data pages.
// Pre-populate read-only AOT code pages without faulting writable heaps
int fd = open(compiled_cwasm_path, O_RDONLY | O_CLOEXEC);
void *rx_base = mmap(NULL, text_len, PROT_READ | PROT_EXEC,
MAP_PRIVATE | MAP_POPULATE, fd, text_offset);
madvise(rx_base, text_len, MADV_WILLNEED);
Using MAP_POPULATE indiscriminately across a 12 MB module stalls the acceptor thread. Instead, mapping only the entry trampoline and routing dispatch table eagerly—while letting rarely executed error formatters fault on demand—cut p99 cold start from 2.9 ms down to 690 µs.
Snapshot Pre-Warming vs. Canonical ABI Copies
WASI Preview 2 introduces typed component interfaces, which means strings and byte slices cross host boundaries via canonical ABI lift/lower rules rather than raw pointer arithmetic. For payloads under 16 KB, copying into a pooled per-request bump arena beats virtual memory remapping every single time because mmap / munmap shootdowns acquire mmap_lock across sibling threads.
Pairing Edge Isolates With Local State
Compute without nearby state merely moves latency from cold starts to database round-trips. Combining pre-snapshot Wasm components with embedded read replicas—configured using the WAL checkpoint discipline in Predictable SQLite WAL Checkpoints in Read-Heavy Edge Services and traced via Sub-1% Overhead Tail-Latency Histograms With Per-CPU eBPF Maps—delivers 11 ms end-to-end p99 responses across continental Europe.
Connected Architecture Notes
- Sub-1% Overhead Tail-Latency Histograms With Per-CPU eBPF MapsObservability · 10m
- Predictable SQLite WAL Checkpoints in Read-Heavy Edge ServicesStorage Engines · 7m
- Top-Layer HTML Dialogs and Tactile Braille Focus DisciplineWeb Platform & A11y · 7m
- Content-Addressed Monorepo Build Caches Without Silent CI DriftDeveloper Tooling · 8m

Henrik Lindqvist
Stockholm · UTC+1Principal distributed systems architect writing weekly benchmarks on consensus protocols, storage engines, WebAssembly isolates, and tactile web accessibility.
Reader Field Notes
1 verified note- Oct 15, 2026
Mei-Ling Zhou
Runtime Systems Engineer · Amsterdam
The `mmap_lock` contention point under `16 KB` payloads is spot on. Switching our WASI HTTP body buffers to a thread-local slab cut p99 latency in half on 64-core Genoa boxes.
Continue Reading
All essays →
Deterministic Raft Lease Quorums Under Asymmetric Cross-AZ Jitter
Oct 28, 2026

Pacing LSM-Tree Compaction Debt on High-Queue NVMe Drives
Sep 27, 2026

Top-Layer HTML Dialogs and Tactile Braille Focus Discipline
Sep 13, 2026
Get next Sunday’s benchmark by email
Full essay in plain HTML, zero tracking pixels, one-click unsubscribe.