Building a 6 million request per second web server
summary
A Java web server (OfficeFloor) hits ~6 million requests per second on TechEmpower benchmarks as a single process using standard non-blocking sockets. It uses one thread per CPU with thread affinity, turns off Nagle and implements its own coalescing, trims database pools to few connections, avoids locks in hot paths in favor of atomics, and applies byte-level bit‑twiddling for HTTP parsing. The result is much higher throughput by reducing cache misses, thread setup and context switch overhead.
AI-written summary · about
chapters (15)
- 0:00Introduction and welcome
- 0:48Why build a custom web server
- 2:15Benchmarking and performance history
- 3:41Hardware vs software performance
- 5:03Understanding hardware latency
- 6:48Network efficiency and Nagle's algorithm
- 7:10Threading overhead and inefficiency
- 8:35Locks and atomic operations impact
- 10:02Threading model for high throughput
- 11:25Thread affinity and cache efficiency
- 12:26Database connection pools optimization
- 14:11Compiler optimization and readable code
- 15:56Functional programming for performance
- 17:22Bit twiddling for HTTP parsing
- 19:07Summary and key takeaways
