From: Willy Tarreau Date: Sun, 15 Dec 2013 14:21:32 +0000 (+0100) Subject: OPTIM: http: set CF_READ_DONTWAIT on response message X-Git-Tag: v1.5-dev20~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f3997e6c6e994883611aa2420990108a8d32dc7;p=thirdparty%2Fhaproxy.git OPTIM: http: set CF_READ_DONTWAIT on response message 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. --- diff --git a/src/proto_http.c b/src/proto_http.c index db6a88700a..2fcff7186d 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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; }