]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: queue: make pendconn_process_next_strm() only return the pendconn
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2021 16:48:06 +0000 (18:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Jun 2021 16:37:41 +0000 (18:37 +0200)
commit5304669e1b1a213d2754755a47735ecd5549ce7b
treefea769e93ee647b230eb1487d02e2ee19a2c517c
parente500e593a79e3797eada5a839aeee017b002d7bf
MEDIUM: queue: make pendconn_process_next_strm() only return the pendconn

It used to do far too much under the lock, including waking up tasks,
updating counters and repositionning entries in the load balancing algo.

This patch first moves all that stuff out of the function into the only
caller (process_srv_queue()). The decision to update the LB algo is now
taken out of the lock. The wakeups could be performed outside of the
loop by using a local list.

This increases the performance from 377k to 431k req/s on 16 threads
with 20 servers under leastconn.

The perf profile changes from this:
  23.17%  haproxy             [.] process_srv_queue
   6.58%  haproxy             [.] pendconn_add
   6.40%  haproxy             [.] pendconn_dequeue
   5.48%  haproxy             [.] fwlc_srv_reposition
   3.70%  haproxy             [.] fwlc_get_next_server

to this:
  13.95%  haproxy             [.] process_srv_queue
   9.96%  haproxy             [.] fwlc_srv_reposition
   6.21%  haproxy             [.] fwlc_get_next_server
   3.96%  haproxy             [.] pendconn_dequeue
   3.75%  haproxy             [.] pendconn_add
src/queue.c