mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-18 09:24:31 +00:00
8f09bdce10
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. |
||
---|---|---|
.. | ||
api | ||
acl.txt | ||
body-parsing.txt | ||
connect-status.txt | ||
connection-header.txt | ||
connection-scale.txt | ||
fd-migration.txt | ||
hashing.txt | ||
list.fig | ||
list.png | ||
listener-states.fig | ||
listener-states.png | ||
lua_socket.fig | ||
lua_socket.pdf | ||
muxes.fig | ||
muxes.pdf | ||
muxes.png | ||
muxes.svg | ||
mworker.md | ||
notes-layers.txt | ||
notes-poll-connect.txt | ||
notes-pollhup.txt | ||
notes-polling.txt | ||
pattern.dia | ||
pattern.pdf | ||
polling-states.fig | ||
sched.fig | ||
sched.pdf | ||
sched.png | ||
sched.svg | ||
ssl_cert.dia | ||
stats-v2.txt | ||
stconn-close.txt | ||
stream-sock-states.fig |