sianla / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

The TCP_NODELAY is not set at the accepted socket #377

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The TCP_NODELAY is only set at the listening socket, and not set at the 
accepted socket. In Linux machine I tested, the TCP_NODELAY on listening socket 
cannot be inherited by the accepted socket.

There is a serious performance problem when TCP_NODELAY is not set on memcached 
server and when the client machine has delayed ack enabled (like default in 
windows, the delayed ACK can be 200ms)

A test case:
client on windows get an item from a linux memcached server. The response item 
size should be >1400 and <2800 (including all parameters)
1. the first 1400 bytes will be sent immediately. and the remaining bytes are 
kept in buffer without sending
2. windows client received the first 1400 bytes and the delay acks take effect.
3. widows client wait 200ms when the delay ack time out happens. Then the ack 
is sent.
4. memcached receives the ack and then the remaining bytes is sent
5. windows client receives the remainning bytes

Result:
The windows client got the item with a delay of 200ms unnecessarily. 

Original issue reported on code.google.com by rone...@gmail.com on 12 Sep 2014 at 8:48