diff options
| author | Fabien Meghazi <fme@odoo.com> | 2019-09-09 10:10:57 +0000 |
|---|---|---|
| committer | Fabien Meghazi <fme@odoo.com> | 2019-12-23 18:03:35 +0000 |
| commit | 6ddf7a50b55e21c21f0295c07cb033e6eb2f382e (patch) | |
| tree | f69b15ea7beb81c4665f0281de9277f6abccc843 /addons/website/data/website_data.xml | |
| parent | bbf93a80858271b0ebb4760e2b6766313de15225 (diff) | |
[IMP] server: prevent threaded server to exceed memory limit due to malloc's arenas
glibc's malloc() uses arenas [1] in order to efficiently handle memory
allocation of multi-threaded applications. This allows better memory
allocation handling in case of multiple threads that would be using
malloc() concurrently [2].
Due to the python's GIL, this optimization have no effect on
multithreaded python programs. Unfortunately, a downside of creating one
arena per cpu core is the increase of virtual memory which Odoo is based
upon in order to limit the memory usage for threaded workers.
On 32bit systems the default size of an arena is 512K while on 64bit
systems it's 64M [3], hence a threaded worker will quickly reach it's
default memory soft limit upon concurrent requests. We therefore set the
maximum arenas allowed to 2 unless the MALLOC_ARENA_MAX env variable is
set.
This commit also brings the following changes:
- allow to disable the memory hard limit for all servers if the provided
value is 0 (instead of crashing)
- increase the log level for threaded server in case of limits reached
Note: Setting MALLOC_ARENA_MAX=0 allow to explicitely set the default
glibs's malloc() behaviour.
[1] https://sourceware.org/glibc/wiki/MallocInternals#Arenas_and_Heaps
[2] https://www.gnu.org/software/libc/manual/html_node/The-GNU-Allocator.html
[3] https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c;h=00ce48c;hb=0a8262a#l862
closes odoo/odoo#42323
X-original-commit: 85fe2c6e60f7f1f6ea72cb55e85f85d420ce6616
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/website/data/website_data.xml')
0 files changed, 0 insertions, 0 deletions
