]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[OPTIM] buffer: new BF_READ_DONTWAIT flag reduces EAGAIN rates
authorWilly Tarreau <w@1wt.eu>
Sat, 21 Mar 2009 20:10:04 +0000 (21:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 21 Mar 2009 20:57:30 +0000 (21:57 +0100)
commit1b194fe03ed2e581de3a26ac06c692aee8623df0
treeedb74fbc6d81d2663a3ee26e95aab5a55f3aede8
parent6f4a82c7aff31d4fd29294a3294bcd5ad1201cd1
[OPTIM] buffer: new BF_READ_DONTWAIT flag reduces EAGAIN rates

When the reader does not expect to read lots of data, it can
set BF_READ_DONTWAIT on the request buffer. When it is set,
the stream_sock_read callback will not try to perform multiple
reads, it will return after only one, and clear the flag.
That way, we can immediately return when waiting for an HTTP
request without trying to read again.

On pure request/responses schemes such as monitor-uri or
redirects, this has completely eliminated the EAGAIN occurrences
and the epoll_ctl() calls, resulting in a performance increase of
about 10%. Similar effects should be observed once we support
HTTP keep-alive since we'll immediately disable reads once we
get a full request.
include/types/buffers.h
src/client.c
src/proto_http.c
src/proto_uxst.c
src/stream_sock.c