How we scaled nginx and saved the world 54 years every day
Jul 31, 2018Ka-Hing Cheung

Summary
This post details modifications to NGINX's event loop handling to improve disk I/O performance. Key contributions include: 1. Identifying that `read()` operations on disk files block the event loop, unlike network I/O. 2. Observing performance outliers in SSD read operations that significantly impact TTFB. 3. Enabling `SO_REUSEPORT` to improve the even distribution of requests across NGINX worker processes. 4. Modifying NGINX to perform `open()` operations within a thread pool, making it non-blocking and preventing event loop stalls. This combined approach resulted in a 6x improvement in peak p99 TTFB and an estimated saving of 54 years of wait time per day across the internet.