haproxy/doc/internals
Willy Tarreau 8f09bdce10 MINOR: buffer: add a buffer list type with functions
The buffer ring is problematic in multiple aspects, one of which being
that it is only usable by one entity. With multiplexed protocols, we need
to have shared buffers used by many entities (streams and connection),
and the only way to use the buffer ring model in this case is to have
each entity store its own array, and keep a shared counter on allocated
entries. But even with the default 32 buf and 100 streams per HTTP/2
connection, we're speaking about 32*101*32 bytes = 103424 bytes per H2
connection, just to store up to 32 shared buffers, spread randomly in
these tables. Some users might want to achieve much higher than default
rates over high speed links (e.g. 30-50 MB/s at 100ms), which is 3 to 5
MB storage per connection, hence 180 to 300 buffers. There it starts to
cost a lot, up to 1 MB per connection, just to store buffer indexes.

Instead this patch introduces a variant which we call a buffer list.
That's basically just a free list encoded in an array. Each cell
contains a buffer structure, a next index, and a few flags. The index
could be reduced to 16 bits if needed, in order to make room for a new
struct member. The design permits initializing a whole freelist at once
using memset(0).

The list pointer is stored at a single location (e.g. the connection)
and all users (the streams) will just have indexes referencing their
first and last assigned entries (head and tail). This means that with
a single table we can now have all our buffers shared between multiple
streams, irrelevant to the number of potential streams which would want
to use them. Now the 180 to 300 entries array only costs 7.2 to 12 kB,
or 80 times less.

Two large functions (bl_deinit() & bl_get()) were implemented in buf.c.
A basic doc was added to explain how it works.
2024-10-12 16:29:15 +02:00
..
api MINOR: buffer: add a buffer list type with functions 2024-10-12 16:29:15 +02:00
acl.txt
body-parsing.txt
connect-status.txt
connection-header.txt
connection-scale.txt
fd-migration.txt CLEANUP: assorted typo fixes in the code and comments 2021-08-16 12:37:59 +02:00
hashing.txt [RELEASE] Released version 2.4-dev19 2021-05-10 07:50:26 +02:00
list.fig [RELEASE] Released version 2.4-dev17 2021-04-23 19:11:10 +02:00
list.png CLEANUP: lists/tree-wide: rename some list operations to avoid some confusion 2021-04-21 09:20:17 +02:00
listener-states.fig
listener-states.png
lua_socket.fig
lua_socket.pdf
muxes.fig DOC: internal: update the muxes doc to mention the stconn 2022-05-27 19:33:35 +02:00
muxes.pdf DOC: internal: update the muxes doc to mention the stconn 2022-05-27 19:33:35 +02:00
muxes.png DOC: internal: update the muxes doc to mention the stconn 2022-05-27 19:33:35 +02:00
muxes.svg DOC: internal: update the muxes doc to mention the stconn 2022-05-27 19:33:35 +02:00
mworker.md DOC: internals: add a documentation about the master worker 2024-06-12 14:46:05 +02:00
notes-layers.txt
notes-poll-connect.txt DOC: internal: commit notes about polling states and flags on connect() 2022-11-17 16:49:00 +01:00
notes-pollhup.txt DOC: internal: commit notes about polling states and flags 2022-11-17 16:49:00 +01:00
notes-polling.txt DOC: internal: commit notes about polling states and flags 2022-11-17 16:49:00 +01:00
pattern.dia
pattern.pdf
polling-states.fig
sched.fig [RELEASE] Released version 2.4-dev10 2021-02-26 22:49:10 +01:00
sched.pdf DOC: scheduler: add a diagram showing the different queues and their usages 2021-02-26 17:49:37 +01:00
sched.png DOC: scheduler: add a diagram showing the different queues and their usages 2021-02-26 17:49:37 +01:00
sched.svg DOC: scheduler: add a diagram showing the different queues and their usages 2021-02-26 17:49:37 +01:00
ssl_cert.dia DOC: internals: update the SSL architecture schema 2021-05-17 10:50:24 +02:00
stats-v2.txt
stconn-close.txt DOC: internal: add a bit of documentation for the stconn closing conditions 2023-05-23 16:18:19 +02:00
stream-sock-states.fig