haproxy/include/proto
Willy Tarreau eaf05be0ee OPTIM: polling: do not create update entries for FD removal
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.
2019-12-27 16:38:47 +01:00
..
acl.h
action.h MINOR: action: new '(http-request|tcp-request content) do-resolve' action 2019-04-23 11:41:52 +02:00
activity.h MINOR: time: move the cpu, mono, and idle time to thread_info 2019-05-20 21:14:14 +02:00
applet.h MINOR: applet: make appctx use their own pool 2019-07-18 10:45:08 +02:00
arg.h
auth.h
backend.h MAJOR: stream: store the target address into s->target_addr 2019-07-19 13:50:09 +02:00
channel.h BUG/MEDIUM: stream-int: Don't rely on CF_WRITE_PARTIAL to unblock opposite si 2019-07-05 14:26:15 +02:00
checks.h
cli.h MINOR: cli: add cli_msg(), cli_err(), cli_dynmsg(), cli_dynerr() 2019-08-09 10:11:38 +02:00
compression.h
connection.h REORG: connection: move tcp_connect_probe() to conn_fd_check() 2019-12-27 16:38:43 +01:00
dict.h MINOR: dict: Add dictionary new data structure. 2019-06-05 08:33:35 +02:00
dns.h MINOR: action: new '(http-request|tcp-request content) do-resolve' action 2019-04-23 11:41:52 +02:00
fcgi-app.h MEDIUM: fcgi-app: Add FCGI application and filter 2019-09-17 10:18:54 +02:00
fd.h OPTIM: polling: do not create update entries for FD removal 2019-12-27 16:38:47 +01:00
filters.h MEDIUM: filters: Adapt filters API to allow again TCP filtering on HTX streams 2019-11-15 13:43:08 +01:00
flt_http_comp.h
freq_ctr.h MINOR: freq_ctr: Make the sliding window sums thread-safe 2019-11-15 13:43:08 +01:00
frontend.h
h1_htx.h MEDIUM: h1-htx: Add HTX EOM block when the message is in H1_MSG_DONE state 2019-12-11 16:46:16 +01:00
hlua_fcn.h
hlua.h MINOR: lua: export applet and task handlers 2019-08-21 14:32:09 +02:00
http_ana.h MINOR: http-ana: Remove the unused function http_reset_txn() 2019-11-07 15:32:52 +01:00
http_fetch.h MEDIUM: http_fetch: Remove code relying on HTTP legacy mode 2019-07-19 09:18:27 +02:00
http_htx.h BUG/MINOR: http_htx: Support empty errorfiles 2019-07-23 14:58:32 +02:00
http_rules.h
lb_chash.h
lb_fas.h
lb_fwlc.h
lb_fwrr.h
lb_map.h
listener.h BUG/MINOR: listener: fix off-by-one in state name check 2019-12-11 15:51:37 +01:00
log.h MINOR: log: Provide a function to emit a log for an application 2019-09-17 10:18:54 +02:00
map.h
mux_pt.h
mworker.h BUG/MINOR: mworker: properly pass SIGTTOU/SIGTTIN to workers 2019-12-11 14:26:53 +01:00
obj_type.h CLEANUP: objtype: make obj_type() and obj_type_name() take consts 2019-05-22 11:50:48 +02:00
pattern.h
payload.h
peers.h MINOR: peers: Make peers protocol support new "server_name" data type. 2019-06-05 08:42:33 +02:00
pipe.h
port_range.h BUG/MEDIUM: port_range: Make the ring buffer lock-free. 2019-04-30 15:10:17 +02:00
proto_sockpair.h
proto_tcp.h REORG: connection: move tcp_connect_probe() to conn_fd_check() 2019-12-27 16:38:43 +01:00
proto_udp.h
protocol_buffers.h BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
protocol.h BUG/MEDIUM: protocols: add a global lock for the init/deinit stuff 2019-07-24 16:45:02 +02:00
proxy.h CLEANUP: proxy: Remove proxy_tbl_by_name 2019-09-30 04:11:36 +02:00
queue.h
raw_sock.h
ring.h MINOR: ring: add a generic CLI io_handler to dump a ring buffer 2019-08-27 17:14:19 +02:00
sample.h MINOR: sample: add us/ms support to date/http_date 2019-10-31 08:47:31 +01:00
server.h MEDIUM: servers: Use LIST_DEL_INIT() instead of LIST_DEL(). 2019-09-23 18:16:08 +02:00
session.h BUG/MEDIUM: sessions: Don't keep an extra idle connection in sessions. 2019-07-04 14:28:18 +02:00
shctx.h BUILD: use inttypes.h instead of stdint.h 2019-04-01 07:44:56 +02:00
signal.h
sink.h MINOR: sink: now report the number of dropped events on output 2019-08-27 17:14:19 +02:00
spoe.h BUG/MEDIUM: spoe: Be sure the sample is found before setting its context 2019-05-07 22:16:41 +02:00
ssl_sock.h MINOR: ssl: ssl_sock_prepare_ctx() return an error code 2019-11-21 17:48:11 +01:00
stats.h MINOR: stats: prepare to add a description with each stat/info field 2019-10-10 11:30:07 +02:00
stick_table.h MINOR: stick-table: Add "server_name" new data type. 2019-06-05 08:33:35 +02:00
stream_interface.h BUG/MEDIUM: stream_interface: Only use SI_ST_RDY when the mux is ready. 2019-10-29 14:15:20 +01:00
stream.h MEDIUM: stream/trace: Register a new trace source with its events 2019-11-06 10:14:32 +01:00
task.h BUG/MAJOR: task: add a new TASK_SHARED_WQ flag to fix foreing requeuing 2019-12-19 14:42:22 +01:00
tcp_rules.h
template.h
trace.h MINOR: trace: Add a set of macros to trace events if HA is compiled with debug 2019-11-06 10:14:32 +01:00
vars.h