15M web servers on one VM – smoltcp, DPDK, AF_XDP kapteko.com · 303 points · 33 ...
HN Best 30 @best30
15M web servers on one VM – smoltcp, DPDK, AF_XDP kapteko.com · 303 points · 33 comments · HN thread
TL;DR A satirical but technically grounded blog post by Kapteko asks how many web servers one VM with 10GB RAM and one CPU core can run, aiming for 15 million. It walks through port limits, IP aliasing via AnyIP, kernel socket memory costs (~3.3KB per socket), and finally moving the TCP/IP stack to userland with smoltcp, DPDK or AF_XDP, reaching about 16M servers in its benchmark.
- Linux ephemeral port range and the 16-bit port field cap a single IP at about 65k listeners, so the author turns to AnyIP to listen on a whole IPv6 subnet.
- Forking one process per server needs about 1.5MB each, which would require roughly 20TB of RAM; a single-process runtime with a 16-byte scheduling context per guest is the proposed fix.
- Each kernel socket costs around 3.3KB across tcp_sock, socket_alloc, file and dentry structs, so 14M idle kernel sockets exhaust 10GB.
- smoltcp, a userland TCP/IP stack, can run over TUN/TAP, while DPDK and AF_XDP bypass the kernel network path; DPDK takes a whole core and removes the NIC from the OS, AF_XDP keeps the device under kernel control.
- The benchmark reports about 620 bytes per idle server and about 1KB per active one with smoltcp, reaching roughly 16M servers, with kernel networking running out of memory near 2.5M.
Discussion The thread is mostly appreciative and focused on the writing rather than the engineering details. Many commenters praise the humour, the British-unit joke and the lack of AI-generated tone, and several reminisce about older personal blogs. Technical threads cover the exokernel analogy, lower-level alternatives such as wildcard transparent proxying, and the question of whether the port limit or the HOST header matters. One commenter is sharply critical, arguing the author's smoltcp choice shows superficial knowledge because smoltcp's connection limits make it unsuitable for public web serving.
- Praise for humour and readable, non-AI writing (most): Most commenters say the article was funny, clearly written and a pleasant change from AI-generated posts. Several say they laughed out loud and want to read more from the author.
- Lower-level approaches would be even better (some): Some point out that the goal can be met without a full HTTP server at all, for example by answering on many IP and port pairs via a wildcard transparent proxy. Others note the exokernel idea and how it relates to the article's approach.
- Critique of smoltcp for real web serving (a few): One commenter argues that smoltcp's low default concurrent connection limit makes it fit only for embedded devices, and that the article shows superficial knowledge from vibe-coding. This is the main dissent in the thread.
- Spec is ambiguous; the title misleads (a few): A few say the title is confusing because 'web' suggests HTTP parsing, and that the 10GB RAM figure is modest enough to be surprising. Suggestions include retitling it '15M servers on one VM'.
- Related history and HTTPS caveat (a few): Some link the C10K problem as background and note that raw HTTP is less common now, so TLS would be a necessary next step.
Links from the comments
- Background on the C10K problem, linked by a commenter as related reading.
- Dan Kegel's original C10K problem write-up.
- Exokernel paper cited in the discussion of kernel design.
#networking #linux #smoltcp #DPDK #AFXDP #systemsProgramming