]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: dynbuf: use emergency buffers upon failed memory allocations
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Apr 2024 06:36:09 +0000 (08:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 May 2024 15:18:13 +0000 (17:18 +0200)
commitfc792694a69f4b98a2fa52f4a5f9c5d67aa97d0d
tree6d8bb60cd7ea3796c882842406619d9c5fef93b4
parent0ce51dc93bc96392fe5b66fcd29a4f3240470b97
MEDIUM: dynbuf: use emergency buffers upon failed memory allocations

Now, if a pool_alloc() fails for a buffer and if conditions are met
based on the queue number, we'll try to get an emergency buffer.

Thanks to this the situation is way more stable now. With only 4 reserve
buffers and 1 buffer it's possible to reliably serve 500 concurrent end-
to-end H1 connections and consult stats in parallel in loops showing the
growing number of buf_wait events in "show activity" without facing an
instant stall like in the past. Lower values still cause quick stalls
though.

It's also apparent that some subsystems do not seem to detach from the
buffer_wait lists when leaving. For example several crashes in the H1
part showed list elements still present after a free(), so maybe some
operations performed inside h1_release() after the b_dequeue() call
can sometimes result in a new allocation. Same for streams, where
the dequeue is done relatively early.
include/haproxy/dynbuf.h