mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-28 15:42:30 +00:00
eaf05be0ee
In order to reduce the number of poller updates, we can benefit from the fact that modern pollers use sampling to report readiness and that under load they rarely report the same FD multiple times in a row. As such it's not always necessary to disable such FDs especially when we're almost certain they'll be re-enabled again and will require another set of syscalls. Now instead of creating an update for a (possibly temporary) removal, we only perform this removal if the FD is reported again as ready while inactive. In addition this is performed via another update so that alternating workloads like transfers have a chance to re-enable the FD without any syscall during the loop (typically after the data that filled a buffer have been sent). However we only do that for single- threaded FDs as the other ones require a more complex setup and are not on the critical path. This does cause a few spurious wakeups but almost totally eliminates the calls to epoll_ctl() on connections seeing intermitent traffic like HTTP/1 to a server or client. A typical example with 100k requests for 4 kB objects over 200 connections shows that the number of epoll_ctl() calls doesn't depend on the number of requests anymore but most exclusively on the number of established connections: Before: % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 57.09 0.499964 0 654361 321190 recvfrom 38.33 0.335741 0 369097 1 epoll_wait 4.56 0.039898 0 44643 epoll_ctl 0.02 0.000211 1 200 200 connect ------ ----------- ----------- --------- --------- ---------------- 100.00 0.875814 1068301 321391 total After: % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 59.25 0.504676 0 657600 323630 recvfrom 40.68 0.346560 0 374289 1 epoll_wait 0.04 0.000370 0 620 epoll_ctl 0.03 0.000228 1 200 200 connect ------ ----------- ----------- --------- --------- ---------------- 100.00 0.851834 1032709 323831 total As expected there is also a slight increase of epoll_wait() calls since delaying de-activation of events can occasionally cause one spurious wakeup. |
||
---|---|---|
.. | ||
acl.h | ||
action.h | ||
activity.h | ||
applet.h | ||
arg.h | ||
auth.h | ||
backend.h | ||
channel.h | ||
checks.h | ||
cli.h | ||
compression.h | ||
connection.h | ||
dict.h | ||
dns.h | ||
fcgi-app.h | ||
fd.h | ||
filters.h | ||
flt_http_comp.h | ||
freq_ctr.h | ||
frontend.h | ||
h1_htx.h | ||
hlua_fcn.h | ||
hlua.h | ||
http_ana.h | ||
http_fetch.h | ||
http_htx.h | ||
http_rules.h | ||
lb_chash.h | ||
lb_fas.h | ||
lb_fwlc.h | ||
lb_fwrr.h | ||
lb_map.h | ||
listener.h | ||
log.h | ||
map.h | ||
mux_pt.h | ||
mworker.h | ||
obj_type.h | ||
pattern.h | ||
payload.h | ||
peers.h | ||
pipe.h | ||
port_range.h | ||
proto_sockpair.h | ||
proto_tcp.h | ||
proto_udp.h | ||
protocol_buffers.h | ||
protocol.h | ||
proxy.h | ||
queue.h | ||
raw_sock.h | ||
ring.h | ||
sample.h | ||
server.h | ||
session.h | ||
shctx.h | ||
signal.h | ||
sink.h | ||
spoe.h | ||
ssl_sock.h | ||
stats.h | ||
stick_table.h | ||
stream_interface.h | ||
stream.h | ||
task.h | ||
tcp_rules.h | ||
template.h | ||
trace.h | ||
vars.h |