RC RANDOM CHAOS

15 Million Web Servers: Ports Aren't the Real Bottleneck

· via Hacker News

Original source

15M web servers on one VM – smoltcp, DPDK, AF_XDP

Hacker News →

The author explores running 15 million web servers on a single VM with just 10GB RAM and one CPU core. Starting with a minimal C web server achieving 65k requests per second, the first obstacle surfaces immediately: port exhaustion. Linux allocates dynamic ports from the range 32768-60999, which provides insufficient capacity for millions of servers. While expanding the range to use all 65,535 ports, sharing ports between UDP and TCP, or adding network interface cards to distribute load across multiple IP addresses could theoretically help, the real bottleneck proves to be memory. Each traditional web server process consumes 1.5MB of RAM; running 15 million would require roughly 20TB of memory—far exceeding the 10GB budget.

The practical solution requires abandoning the per-process model for a custom userland runtime that multiplexes all servers within one process using lightweight context switching. This approach stores only 16 bytes of state per server (totaling 220MB for 15 million), plus memory for active TCP connections (approximately 5KB each). The article illustrates how extreme scaling forces developers to fundamentally redesign architectures in response to operating system constraints.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.