haproxy/src
Willy Tarreau 758cb450a2 OPTIM: sink: drop the sink lock used to count drops
The sink lock was made to prevent event producers from passing while
there were other threads trying to print a "dropped" message, in order
to guarantee the absence of reordering. It has a serious impact however,
which is that all threads need to take the read lock when producing a
regular trace even when there's no reader.

This patch takes a different approach. The drop counter is shifted left
by one so that the lowest bit is used to indicate that one thread is
already taking care of trying to dump the counter. Threads only read
this value normally, and will only try to change it if it's non-null,
in which case they'll first check if they are the first ones trying to
dump it, otherwise will simply count another drop and leave. This has
a large benefit. First, it will avoid the locking that causes stalls
as soon as a slow reader is present. Second, it avoids any write on the
fast path as long as there's no drop. And it remains very lightweight
since we just need to add +2 or subtract 2*dropped in operations, while
offering the guarantee that the sink_write() has succeeded before
unlocking the counter.

While a reader was previously limiting the traffic to 11k RPS under
4C/8T, now we reach 36k RPS vs 14k with no reader, so readers will no
longer slow the traffic down and will instead even speed it up due to
avoiding the contention down the chain in the ring. The locking cost
dropped from ~75% to ~60% now (it's in ring_write now).
2024-03-09 11:23:52 +01:00
..
acl.c MINOR: acl: add extra diagnostics about suspicious string patterns 2024-02-03 12:08:11 +01:00
action.c MINOR: support for http-request set-timeout client 2023-09-28 08:49:22 +02:00
activity.c MINOR: activity: report profiling duration and age in "show profiling" 2023-11-14 11:46:37 +01:00
applet.c BUG/MEDIUM: applet: Fix HTX .rcv_buf callback function to release outbuf buffer 2024-02-26 16:40:13 +01:00
arg.c
auth.c
backend.c MEDIUM: tcp-act/backend: support for set-bc-{mark,tos} actions 2024-02-01 10:58:30 +01:00
base64.c
cache.c MINOR: muxes/applet: Simplify checks on options to disable zero-copy forwarding 2024-02-14 15:41:04 +01:00
calltrace.c BUG/MINOR: calltrace: fix 'now' being used in place of 'date' 2023-04-27 18:14:57 +02:00
cbuf.c
cfgcond.c MINOR: protocol: move the global reuseport flag to the protocols 2023-04-23 09:46:15 +02:00
cfgdiag.c
cfgparse-global.c BUG/MINOR: ext-check: cannot use without preserve-env 2023-12-08 14:26:06 +01:00
cfgparse-listen.c BUG/MINOR: cfgparse-listen: fix warning being reported as an alert 2023-12-01 09:09:45 +01:00
cfgparse-quic.c MINOR: quic: Dynamic packet reordering threshold 2024-02-14 11:32:29 +01:00
cfgparse-ssl.c MEDIUM: ssl: implements 'default-crt' keyword for bind Lines 2024-01-12 17:40:42 +01:00
cfgparse-tcp.c BUG/MINOR: cfgparse-tcp: leak when re-declaring interface from bind line 2023-06-06 15:15:17 +02:00
cfgparse-unix.c
cfgparse.c BUG/MINOR: cfgparse: report proper location for log-format-sd errors 2024-03-07 11:48:17 +01:00
channel.c MINOR: tree-wide: Only rely on co_data() to check channel emptyness 2023-10-17 18:51:13 +02:00
check.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
chunk.c MEDIUM: init: initialize the trash earlier 2023-09-08 16:25:19 +02:00
cli.c BUG/MAJOR: cli: Restore non-interactive mode behavior with pipelined commands 2024-02-23 15:19:49 +01:00
clock.c MINOR: clock: provide a function to automatically adjust now_offset 2023-05-17 09:33:54 +02:00
compression.c MINOR: compression/slz: add support for a pure flush of pending bytes 2023-06-30 16:12:36 +02:00
connection.c MEDIUM: tcp-act/backend: support for set-bc-{mark,tos} actions 2024-02-01 10:58:30 +01:00
cpuset.c REORG: cpuset: move parse_cpu_set() and parse_cpumap() to cpuset.c 2023-09-08 16:25:19 +02:00
debug.c BUILD: address a few remaining calloc(size, n) cases 2024-02-10 11:37:27 +01:00
dgram.c MINOR: dgram: allow to set rcv/sndbuf for dgram sockets as well 2023-10-18 17:01:19 +02:00
dict.c
dns.c MINOR: applet: Remove uselelss test on SE_FL_SHR/SHW flags 2024-02-14 14:22:36 +01:00
dynbuf.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
eb32sctree.c
eb32tree.c
eb64tree.c
ebimtree.c
ebistree.c
ebmbtree.c
ebpttree.c
ebsttree.c
ebtree.c
errors.c BUG/MINOR: diag: always show the version before dumping a diag warning 2024-02-03 12:08:11 +01:00
ev_epoll.c
ev_evports.c
ev_kqueue.c
ev_poll.c
ev_select.c
event_hdl.c LICENSE: event_hdl: fix GPL license version 2024-02-28 15:13:27 +01:00
extcheck.c MINOR: ext-check: add an option to preserve environment variables 2023-11-23 16:53:57 +01:00
fcgi-app.c CLEANUP: log: deinitialization of the log buffer in one function 2024-01-30 08:27:26 +01:00
fcgi.c
fd.c
filters.c Revert "MINOR: filter: "filter" requires TCP or HTTP mode" 2023-11-18 11:16:21 +01:00
fix.c
flt_bwlim.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
flt_http_comp.c BUG/MINOR: compression: possible NULL dereferences in comp_prepare_compress_request() 2023-11-29 08:59:27 +01:00
flt_spoe.c MINOR: applet: Remove uselelss test on SE_FL_SHR/SHW flags 2024-02-14 14:22:36 +01:00
flt_trace.c BUG/MINOR: trace: show wall-clock date, not internal date in show activity 2023-04-27 18:22:34 +02:00
freq_ctr.c BUG/MEDIUM: freq-ctr: Don't report overshoot for long inactivity period 2023-11-08 16:38:06 +01:00
frontend.c MINOR: frontend: implement a dedicated actconn increment function 2023-10-26 15:18:48 +02:00
h1_htx.c BUG/MINOR: h1-htx: properly initialize the err_pos field 2024-01-31 15:22:12 +01:00
h1.c CLEANUP: h1: remove unused function h1_measure_trailers() 2024-01-31 15:22:12 +01:00
h2.c MINOR: h2: Set the BODYLESS_RESP flag on the HTX start-line if necessary 2023-10-17 18:51:13 +02:00
h3_stats.c MEDIUM: stats: Be able to access a specific field into a stats module 2024-02-01 12:00:53 +01:00
h3.c MINOR: mux-quic: realign Tx buffer if possible 2024-01-31 16:28:54 +01:00
haproxy.c MINOR: quic: Dynamic packet reordering threshold 2024-02-14 11:32:29 +01:00
hash.c
hlua_fcn.c MEDIUM: server: make server_set_inetaddr() updater serializable 2023-12-21 14:22:27 +01:00
hlua.c CLEANUP: hlua: txn class functions may LJMP 2024-03-04 16:48:51 +01:00
hpack-dec.c
hpack-enc.c
hpack-huff.c
hpack-tbl.c
hq_interop.c MEDIUM: mux-quic: properly handle conn Tx buf exhaustion 2024-01-31 16:28:54 +01:00
http_acl.c
http_act.c CLEANUP: log: deinitialization of the log buffer in one function 2024-01-30 08:27:26 +01:00
http_ana.c MEDIUM: htx/http-ana: No longer close connection on early HAProxy response 2024-02-28 16:02:33 +01:00
http_client.c CLEANUP: tree-wide: use proper ERR_* return values for PRE_CHECK fcts 2024-03-07 11:48:08 +01:00
http_conv.c
http_ext.c LICENSE: http_ext: fix GPL license version 2024-02-28 15:13:35 +01:00
http_fetch.c MEDIUM: htx/http-ana: No longer close connection on early HAProxy response 2024-02-28 16:02:33 +01:00
http_htx.c CLEANUP: log: deinitialization of the log buffer in one function 2024-01-30 08:27:26 +01:00
http_rules.c CLEANUP: log: deinitialization of the log buffer in one function 2024-01-30 08:27:26 +01:00
http.c MEDIUM: http: add the ability to redefine http-err-codes and http-fail-codes 2024-01-11 15:10:08 +01:00
htx.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
init.c
jwt.c
lb_chash.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
lb_fas.c
lb_fwlc.c
lb_fwrr.c
lb_map.c
linuxcap.c MEDIUM: capabilities: enable support for Linux capabilities 2023-08-29 11:11:50 +02:00
listener.c MINOR: quic: warn on bind on multiple addresses if no IP_PKTINFO support 2024-02-20 16:40:14 +01:00
log.c CLEANUP: log: fix obsolete comment for add_sample_to_logformat_list() 2024-03-07 11:47:56 +01:00
lru.c
mailers.c MINOR: mailers/hlua: disable email sending from lua 2023-05-05 16:28:32 +02:00
map.c MINOR: map: add map_*_key converters to provide the matching key 2023-12-21 14:22:27 +01:00
mjson.c BUILD: mjson: Fix warning about unused variables 2023-05-11 09:22:46 +02:00
mqtt.c
mux_fcgi.c MINOR: muxes: Implement ->sctl() callback for muxes and return the stream id 2023-11-29 11:11:12 +01:00
mux_h1.c MEDIUM: htx/http-ana: No longer close connection on early HAProxy response 2024-02-28 16:02:33 +01:00
mux_h2.c CLEANUP: mux-h2: Fix h2s_make_data() comment about the return value 2024-02-29 13:57:44 +01:00
mux_pt.c MINOR: muxes/applet: Simplify checks on options to disable zero-copy forwarding 2024-02-14 15:41:04 +01:00
mux_quic.c BUG/MINOR: mux-quic: fix crash on aborting uni remote stream 2024-03-06 10:41:01 +01:00
mworker-prog.c MEDIUM: clock: replace timeval "now" with integer "now_ns" 2023-04-28 16:08:08 +02:00
mworker.c MINOR: mworker/cli: implement hard-reload over the master CLI 2023-11-24 21:44:25 +01:00
namespace.c BUG/MINOR: namespace: missing free in netns_sig_stop() 2023-06-14 11:27:29 +02:00
ncbuf.c MINOR: ncbuf: missing malloc checks in standalone code 2023-05-12 09:45:30 +02:00
pattern.c MINOR: map: mapfile ordering also matters for tree-based match types 2024-01-11 11:13:54 +01:00
payload.c MEDIUM: tree-wide: fetches that may return IPV4+IPV6 now return ADDR 2023-07-03 16:32:01 +02:00
peers.c MINOR: applet: Remove uselelss test on SE_FL_SHR/SHW flags 2024-02-14 14:22:36 +01:00
pipe.c
pool.c BUG/MEDIUM: pool: fix rare risk of deadlock in pool_flush() 2024-02-10 12:38:40 +01:00
proto_quic.c CLEANUP: Re-apply xalloc_size.cocci (3) 2023-11-06 20:49:56 +01:00
proto_rhttp.c CLEANUP: assorted typo fixes in the code and comments 2024-01-02 10:19:48 +01:00
proto_sockpair.c
proto_tcp.c MINOR: protocol: move the global reuseport flag to the protocols 2023-04-23 09:46:15 +02:00
proto_udp.c MEDIUM: udp: allow to retrieve the frontend destination address 2024-01-02 11:44:42 +01:00
proto_uxdg.c
proto_uxst.c MINOR: proto: skip socket setup for duped FDs 2023-04-21 17:41:26 +02:00
protocol.c MINOR: quic+openssl_compat: Do not start without "limited-quic" 2023-08-17 15:44:03 +02:00
proxy.c BUG/MEDIUM: server: fix dynamic servers initial settings 2024-02-27 17:02:20 +01:00
qmux_http.c MEDIUM: mux-quic: add BUG_ON if sending on locally closed QCS 2023-12-21 15:42:08 +01:00
qmux_trace.c MEDIUM: mux-quic: simplify sending API 2024-01-31 16:28:54 +01:00
qpack-dec.c BUG/MINOR: qpack: reject invalid dynamic table capacity 2024-02-15 17:46:53 +01:00
qpack-enc.c BUG/MEDIUM: qpack: allow 6xx..9xx status codes 2024-01-29 15:40:19 +01:00
qpack-tbl.c
queue.c MEDIUM: clock: replace timeval "now" with integer "now_ns" 2023-04-28 16:08:08 +02:00
quic_ack.c BUILD: quic: Variable name typo inside a BUG_ON(). 2024-02-05 14:31:21 +01:00
quic_cc_cubic.c CLEANUP: assorted typo fixes in the code and comments 2024-03-05 11:50:34 +01:00
quic_cc_newreno.c REORG: quic: Move QUIC path definitions/declarations to quic_cc module 2023-11-28 15:37:50 +01:00
quic_cc_nocc.c REORG: quic: Move QUIC path definitions/declarations to quic_cc module 2023-11-28 15:37:50 +01:00
quic_cc.c
quic_cid.c CLEANUP: quic_cid: remove unused listener arg 2023-11-30 15:04:27 +01:00
quic_cli.c MINOR: quic: add MUX output for show quic 2024-02-29 10:03:36 +01:00
quic_conn.c BUG/MEDIUM: quic: fix connection freeze on post handshake 2024-03-06 10:39:57 +01:00
quic_fctl.c MINOR: mux-quic: define a flow control related type 2024-01-31 16:28:54 +01:00
quic_frame.c BUG/MINOR: quic: reject unknown frame type 2024-02-15 17:04:17 +01:00
quic_loss.c MINOR: quic: Add a counter for reordered packets 2024-02-14 11:32:29 +01:00
quic_openssl_compat.c BUG/MEDIUM: quic: keylog callback not called (USE_OPENSSL_COMPAT) 2024-01-16 10:17:27 +01:00
quic_retransmit.c REORG: quic: Add a new module for retransmissions 2023-11-28 15:47:18 +01:00
quic_retry.c REORG: quic: Add a new module for QUIC retry 2023-11-28 15:47:18 +01:00
quic_rx.c MINOR: quic: always use ncbuf for rx CRYPTO 2024-03-08 17:22:48 +01:00
quic_sock.c BUG/MEDIUM: quic: fix connection freeze on post handshake 2024-03-06 10:39:57 +01:00
quic_ssl.c MINOR: quic: always use ncbuf for rx CRYPTO 2024-03-08 17:22:48 +01:00
quic_stats.c MEDIUM: stats: Be able to access a specific field into a stats module 2024-02-01 12:00:53 +01:00
quic_stream.c MEDIUM: mux-quic: properly handle conn Tx buf exhaustion 2024-01-31 16:28:54 +01:00
quic_tls.c MINOR: quic: always use ncbuf for rx CRYPTO 2024-03-08 17:22:48 +01:00
quic_tp.c MINOR: quic: Transport parameters encoding without version_information 2024-01-23 16:03:29 +01:00
quic_trace.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
quic_tx.c REORG: quic: Add a new module for retransmissions 2023-11-28 15:47:18 +01:00
raw_sock.c MEDIUM: raw-sock: Specifiy amount of data to send via snd_pipe callback 2023-10-17 18:51:13 +02:00
regex.c
resolvers.c CLEANUP: tree-wide: use proper ERR_* return values for PRE_CHECK fcts 2024-03-07 11:48:08 +01:00
ring.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
sample.c MINOR: sample: add type_to_smp() helper function 2024-02-20 15:18:39 +01:00
server_state.c BUG/MINOR: server-state: Avoid warning on 'file not found' 2023-07-21 15:08:27 +02:00
server.c BUG/MEDIUM: server: fix dynamic servers initial settings 2024-02-27 17:02:20 +01:00
session.c MINOR: session: add the necessary functions to update the per-session glitches 2024-02-08 15:51:49 +01:00
sha1.c
shctx.c BUG/MINOR: shctx: Remove old HA_SPIN_INIT 2023-11-17 16:56:18 +01:00
signal.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
sink.c OPTIM: sink: drop the sink lock used to count drops 2024-03-09 11:23:52 +01:00
slz.c IMPORT: slz: implement a synchronous flush() operation 2023-06-30 16:12:36 +02:00
sock_inet.c MINOR: protocol: move the global reuseport flag to the protocols 2023-04-23 09:46:15 +02:00
sock_unix.c BUG/MINOR: sock: mark abns sockets as non-suspendable and always unbind them 2023-11-20 11:38:26 +01:00
sock.c MEDIUM: tcp-act/backend: support for set-bc-{mark,tos} actions 2024-02-01 10:58:30 +01:00
ssl_ckch.c BUG/MINOR: ssl/cli: typo in new ssl crl-file CLI description 2024-03-05 14:49:17 +01:00
ssl_crtlist.c BUG/MINOR: ssl/cli: duplicate cleaning code in cli_parse_del_crtlist 2024-02-27 18:10:43 +01:00
ssl_gencert.c REORG: ssl: move 'generate-certificates' code to ssl_gencert.c 2024-01-12 17:40:42 +01:00
ssl_ocsp.c CLEANUP: tree-wide: use proper ERR_* return values for PRE_CHECK fcts 2024-03-07 11:48:08 +01:00
ssl_sample.c MINOR: Add aes_gcm_enc converter 2024-03-08 17:20:43 +01:00
ssl_sock.c BUG/MAJOR: ssl/ocsp: crash with ocsp when old process exit or using ocsp CLI 2024-02-26 18:04:25 +01:00
ssl_utils.c BUILD: ssl: ssl_c_r_dn fetches uses functiosn only available since 1.1.1 2023-05-15 12:07:52 +02:00
stats.c BUG/MINOR: stats: drop srv refcount on early release 2024-02-22 18:24:35 +01:00
stconn.c BUG/MAJOR: stconn: Check support for zero-copy forwarding on both sides 2024-02-14 15:41:02 +01:00
stick_table.c CLEANUP: fix typo in naming for variable "unused" 2024-03-05 11:50:34 +01:00
stream.c BUG/MAJOR: server: fix stream crash due to deleted server 2024-02-22 18:36:54 +01:00
task.c CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
tcp_act.c MEDIUM: tcp-act/backend: support for set-bc-{mark,tos} actions 2024-02-01 10:58:30 +01:00
tcp_rules.c MINOR: log/backend: prevent tcp-{request,response} use with LOG mode 2023-11-18 11:16:21 +01:00
tcp_sample.c MINOR: sample: accept_date / request_date return %Ts / %tr timestamp values 2023-07-24 17:12:29 +02:00
tcpcheck.c CLEANUP: log: deinitialization of the log buffer in one function 2024-01-30 08:27:26 +01:00
thread.c MEDIUM: cache: Use dedicated cache tree lock alongside shctx lock 2023-11-16 19:35:10 +01:00
time.c
tools.c BUG/MINOR: tools: seed the statistical PRNG slightly better 2024-03-01 16:25:39 +01:00
trace.c MINOR: trace: support -dt optional format 2023-11-27 17:15:14 +01:00
uri_auth.c
uri_normalizer.c
vars.c MINOR: vars: export var_set and var_unset functions 2024-03-08 17:20:43 +01:00
version.c
wdt.c
xprt_handshake.c
xprt_quic.c BUG/MEDIUM: quic: fix connection freeze on post handshake 2024-03-06 10:39:57 +01:00