]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: splicing: use splice() for the last block when relevant
authorWilly Tarreau <w@1wt.eu>
Thu, 18 Jul 2013 20:21:54 +0000 (22:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Jul 2013 07:31:56 +0000 (09:31 +0200)
commitfa8e2bc68c583a227ebc78bab5779b84065b28da
tree0ec3e4f07607a6a681a4f79c4c633f5057531e9b
parent5007d2aa33c25f521f94733af56422062f80ba4b
OPTIM: splicing: use splice() for the last block when relevant

Splicing is avoided for small transfers because it's generally cheaper
to perform a couple of recv+send calls than pipe+splice+splice. This
has the consequence that the last chunk of a large transfer may be
transferred using recv+send if it's less than 4 kB. But when the pipe
is already set up, it's better to use splice() to read the pending data,
since they will get merged with the pending ones. This is what now
happens everytime the reader is slower than the writer.

Note that this change alone could have fixed most of the CPU hog bug,
except at the end when only the close was pending.
src/stream_interface.c