pipelined commands and corking

Brad Fitzpatrick brad at danga.com
Sun Dec 26 21:59:41 PST 2004


I just noticed a bug of sorts in memcached:

If you use pipelined commands (does any client?) then the
corking/uncorking is wrong, and because we never set NODELAY on client
sockets, the response to the client is Nagel-itized.

Simple hack:

conn *conn_new(int sfd, int init_state, int event_flags) {
    conn *c;
    int flags = 1;

    /* set NODELAY on all new connections.  there's a bug of sorts in
       the corking/uncorking of pipelined commands, so this makes sure
       commands that are outside a cork/uncork block will send immediately */

    setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags));

....



If anybody (Sean? Avva?) wants to find the proper fix, let me know.
Or if we should just include the above.

Sean, if you're going to proceed with the binary protocol and making
get_multi go away (to be replaced with pipelined gets), then the above
is of interest.  (if clients don't advertise their pipeline depth)

- Brad



More information about the memcached mailing list