跪拜 Guibai
← All articles
WebAssembly · Browser · Linux

Linux in a Browser Tab: The Benchmarks Check Out, the Bandwidth Doesn't

By Flynt ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Anyone shipping browser-based Linux will hit the same wall: the unkernel engine is CPU-fast, but the first-run experience is ruled by network jitter and Nix closure size. Until caching and CDN distribution are solved, this remains a demo for fast connections, not a replacement for local VMs.

Summary

trynix.dev presents a browser-based Linux VM powered by unkernel, a project that compiles the Linux kernel to WebAssembly instead of emulating it. The demo workloads, from xeyes to Firefox, run without a server, and the official bench figures show 2-32x speedups over the QEMU-wasm alternative. A hands-on test found those numbers hold up, but only after you get past a 9-minute download hurdle for the initial VM and dependency closure, thanks to a slow connection to the Nix cache.

The test exposed the split between CPU and network. The kernel itself downloads in under a second and compiles in 21ms on the official demo, but on a typical cloud host, pulling the 17 store paths for xeyes - including a 9.7MiB glibc - turned "fetching" into a 40-minute marathon. The second boot is dramatically faster because HTTP caching preserves most of the VM image. The bench table, run back-to-back on an EPYC server, shows ripgrep at 13.5x cold and 14.7x hot over QEMU, while python, a user-space-heavy workload, gets only 4.8x. The eye-catching 32x figure is historical, comparing the latest unkernel to an early QEMU version.

The design uses a Wayland compositor for GUI, virgl for OpenGL, and translates every TCP connection into a WebSocket through a Wisp relay, letting curl and git work inside the guest. Two quirks surfaced in release notes: an early clock bug skewed guest-reported benchmark times by 3.3x, and a missing entropy source caused a 50-second hang on first commands. The conclusion: the claims are real, but the convenience is capped by your bandwidth.

Takeaways
— trynix.dev's unkernel engine compiles the Linux kernel to WebAssembly, avoiding full-system emulation for the kernel side.
— On the official demo, the 10.2 MiB kernel wasm downloaded in 914ms and compiled in 21ms; real-world downloads depend on your connection to cache.nixos.org.
— The first boot of xeyes in the test took 9 minutes because the 17 store paths (including a 9.7 MiB glibc) had to be pulled from the Nix cache over a slow link; the VM image alone is 13 MiB.
— A second boot after a browser crash resumed from the HTTP cache, showing large parts of the VM image are reused.
— The bench table on a 256-thread EPYC server shows ripgrep at 13.5x cold and 14.7x hot speedups over QEMU; python gets only 4.8x cold and 3.1x hot.
— The 32x speedup figure in promotional material compares the latest unkernel against an early QEMU version, not a back-to-back current comparison.
— Guest environment issues: a clock bug made guest-reported timings 3.3x too long, and a missing entropy source cost 50 seconds on first commands.
— Network traffic from the guest is carried over WebSockets through a Wisp relay, so curl, git, and pip work without a real TCP stack.
— GUI programs render through a Wayland compositor; OpenGL is offloaded to WebGL2 via a minimal Mesa build with virgl.
— Running Firefox inside the VM needs 2 GiB of memory; each VM gets a 4 GiB data disk by default (10 GiB cap) using browser storage quota, with automatic session suspend when the tab is backgrounded.
Conclusions

The 32x speedup number is a marketing artifact: it compares the latest unkernel to an early QEMU baseline. Back-to-back, the real advantage is 13.5x for ripgrep and below 5x for Python, which is still meaningful but not the headline.

Measuring performance with the guest's own clock is a trap; the release notes show that a 3.3x slowdown on the clock invalidated every 'guest-reported' benchmark until it was fixed. Any benchmark suite run inside a VM should use an external clock.

Routing every guest TCP connection over WebSockets through a relay is a clever design, but it adds a dependency on a third-party relay and an allowlist for domain access; that's a scalability question once many users run arbitrary network tools.

Concepts & terms
unkernel
A project that compiles the Linux kernel itself to WebAssembly, letting the kernel run at near-native speed while only user-space aarch64 code is emulated. This avoids the cost of emulating the entire machine, which is why it's faster than QEMU-wasm.
Wisp relay
A WebSocket proxy protocol that translates guest TCP connections into WebSocket messages, letting programs inside a WebAssembly sandbox access the network without a real TCP stack.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗