BUG/MINOR: quic: do not allocate more rxbufs than necessary
authorWilly Tarreau <w@1wt.eu>
Wed, 21 Dec 2022 08:16:55 +0000 (09:16 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Dec 2022 08:27:26 +0000 (09:27 +0100)
commit8d49253588e89108fe9dac5e3b231fcd85784b6c
tree55fbd20c5eb2fba74f9e47d9b132a61796f66cc9
parenteed782652999f57e35061f06bdb03f60fbf90334
BUG/MINOR: quic: do not allocate more rxbufs than necessary

When QUIC thread binding was fixed by commit f5a0c8abf ("MEDIUM: quic:
respect the threads assigned to a bind line"), one point was overlooked
regarding rxbuf allocation. Indeed, there's one rxbuf per listener and
per bound thread. Originally the loop would iterate over all threads,
but this is not needed anymore and causes lots of memory to be allocated
in scenarios where shards are used, the worst one being "shards by-thread"
which allocates N^2 buffers for N threads. This gives us 2304 buffers
(or 576 MB of RAM) for 48 threads!

Let's only allocate one buffer per bound thread on each listener to fix
this.

This should be backported to 2.7 and generally wherever the commit
above is backported. It depends on the previous commit below:
"BUG/MEDIUM: quic: properly take shards into account on bind lines"
src/proto_quic.c