From a81c80c27e1785c8dd1a354857d3c8b4c9b99282 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Fri, 6 Mar 2020 11:03:18 +0100 Subject: [PATCH] auth docs: talk about glibc & MALLOC_ARENA_MAX --- docs/performance.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/performance.rst b/docs/performance.rst index 850e352b9e..e605132e80 100644 --- a/docs/performance.rst +++ b/docs/performance.rst @@ -120,6 +120,19 @@ mind that the Query Cache mostly saves database access but that the Packet Cache also saves a lot of CPU because 0 internal processing is done when answering a question from the Packet Cache. +Caches & Memory Allocations & glibc +----------------------------------- + +Managing the two caches described above involves a lot of memory management, that is handled by ``malloc`` in your libc. +To avoid contention between threads, the allocator in glibc separates memory into separate arenas, sometimes even hundreds of them. +This avoids locking, but it may cause massive memory fragmentation, that could make PowerDNS take `an order of magnitude more memory `_ in some situations. + +If you suspect this is happening on your setup, you can consider lowering ``MALLOC_ARENA_MAX`` to a small number. +Several users have reported that ``4`` works well for them. +Via ``systemctl edit pdns`` you can put ``Environment=MALLOC_ARENA_MAX=4`` in your pdns unit file to enable this tweak. + +Note that `newer glibc versions replace MALLOC_ARENA_MAX with a different setting syntax `__. + Performance Monitoring ---------------------- -- 2.47.2