From 3f3997e6c6e994883611aa2420990108a8d32dc7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 15 Dec 2013 15:21:32 +0100 Subject: [PATCH] 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. --- src/proto_http.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/proto_http.c b/src/proto_http.c index db6a88700..2fcff7186 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; }