Every article about Nginx optimization talks about using the sendfile
, tcp_nodelay
and tcp_nopush
settings. Unfortunately, none of them explains neither why they should be used, nor how they actually work.
A few weeks ago, as we were building Botify SAAS platform, we started working on the Web server performances. As we're relying a lot on peer review to improve the quality of our work, Greg left my pull request open with questions, lots of questions, most of them starting with "Why?".
As we didn't find any obvious answer, we started a journey inside the Linux Kernel TCP stack, trying to understand Nginx internals and why we should combine 2 options as opposed as tcp_nopush
and tcp_nodelay
.
How can I force a socket to send the data in its buffer? One answer to that tricky question lies in the TCP_NODELAY
option of the Linux TCP(7)
stack. When you