mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
In 97ea9c49f1 ("BUG/MEDIUM: fd: always align fdtab[] to 64 bytes"), the patch doesn't do what the message says. The intent was only to align the base fdtab addr on 64 bytes so that all fdtab entries are aligned and thus don't share the same cache line. For that, fdtab pointer is adjusted from fdtab_addr (unaligned) address after it is allocated. Thus, all we need is an extra 64 bytes in the fdtab_addr array for the aligment. Because we use calloc() to perform the allocation, a dumb mistake was made: the '+64' was added on <size> calloc argument, which means EACH fdtab entry is allocated with 64 extra bytes. Given that a single fdtab entry is 64 bytes, since 97ea9c49f1 each fdtab entry now takes 128 bytes! We doubled fdtab memory consumption. To give you an idea, on my laptop, when looking at memory consumption using 'ps -p `pidof haproxy` -o size' right after starting haproxy process with default settings (no maxsock enforced): before 97ea9c49f1: -> 118440 (KB, ~= 118MB) after 97ea9c49f1: -> 183976 (KB, ~= 184MB) To fix this, use calloc with 1 <nmemb> and manually provide the size with <size> as we would do if we used malloc(). With this patch, we're back to pre-97ea9c49f1 for fdtab memory consumption (with 64 extra bytes the whole array, which is insignificant). It should be backported to all stable versions.
The HAProxy documentation has been split into a number of different files for ease of use. Please refer to the following files depending on what you're looking for : - INSTALL for instructions on how to build and install HAProxy - BRANCHES to understand the project's life cycle and what version to use - LICENSE for the project's license - CONTRIBUTING for the process to follow to submit contributions The more detailed documentation is located into the doc/ directory : - doc/intro.txt for a quick introduction on HAProxy - doc/configuration.txt for the configuration's reference manual - doc/lua.txt for the Lua's reference manual - doc/SPOE.txt for how to use the SPOE engine - doc/network-namespaces.txt for how to use network namespaces under Linux - doc/management.txt for the management guide - doc/regression-testing.txt for how to use the regression testing suite - doc/peers.txt for the peers protocol reference - doc/coding-style.txt for how to adopt HAProxy's coding style - doc/internals for developer-specific documentation (not all up to date)
Description
Languages
C
98.1%
Shell
0.8%
Makefile
0.5%
Lua
0.2%
Python
0.2%