I've been bit recently by the combination of a delayed ACK on the server-side and Nagle's algorithm on the client side, producing the recognizable 40ms delay that is documented here: http://www.boundary.com/blog/2012/05/know-a-delay-nagles-algorithm-and-you/
The easiest way to fix this is to use TCP_NODELAY on the client side (or TCP_CORK should work in our case too). However, I don't have direct control over the client, and would like to try a server side fix. It seems that the TCP_QUICKACK option would do the trick here, since the server would immediately ACK, causing Nagle's algorithm on the client side to send the next packet without delay.
Surprisingly, I couldn't find any reference to people trying this before. Is it a bad idea (besides the fact that we'll be sending more, possibly gratuitous, ACKs)? Since it doesn't look like this option is available via any nginx config, is the best bet to just patch nginx directly (perhaps around http://hg.nginx.org/nginx/file/dcae651b2a0c/src/http/ngx_http_request.c#l3025)?
Thanks!