]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: http: set CF_READ_DONTWAIT on response message
authorWilly Tarreau <w@1wt.eu>
Sun, 15 Dec 2013 14:21:32 +0000 (15:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 16 Dec 2013 01:23:52 +0000 (02:23 +0100)
strace shows a lot of EAGAIN on small response messages. This
is caused by the fact that the READ_DONTWAIT flag is not set
on response message, it's only there when we want to flush
pending data.

For small responses, it's a waste of CPU cycles to call recv()
for nothing since most of the time, everything we'll need will
be in the first response. Also, this will offer more opportunities
for using splice() to transfer data.

src/proto_http.c

index db6a88700af11841f04adbe349bb41896b8e1de3..2fcff7186dac3399ae50d3789241448da8c2791b 100644 (file)
@@ -5230,6 +5230,7 @@ int http_wait_for_response(struct session *s, struct channel *rep, int an_bit)
                }
 
                channel_dont_close(rep);
+               rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
                return 0;
        }