]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[OPTIM] stream_sock: don't use splice on too small payloads
authorWilly Tarreau <w@1wt.eu>
Wed, 11 May 2011 18:47:24 +0000 (20:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 30 May 2011 16:42:41 +0000 (18:42 +0200)
commit14acc7072ea1b31c897df27deea4f69cfc3a364e
treeeab4f116b9d9f710e22c846469a8246e876b0b53
parent22be90b8db8393392e5b46b7dfff6f702db58687
[OPTIM] stream_sock: don't use splice on too small payloads

It's more expensive to call splice() on short payloads than to use
recv()+send(). One of the reasons is that doing a splice() involves
allocating a pipe. One other reason is that the kernel will have to
copy itself if we try to splice less than a page. So let's fix a
short offset of 4kB below which we don't splice.

A quick test shows that on chunked encoded data, with splice we had
6826 syscalls (1715 splice, 3461 recv, 1650 send) while with this
patch, the same transfer resulted in 5793 syscalls (3896 recv, 1897
send).
include/common/defaults.h
src/stream_sock.c