]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
doc: note MALLOC_MMAP_THRESHOLD_ as a potential workaround
authorEric Wong <e@80x24.org>
Mon, 15 Apr 2024 19:50:56 +0000 (19:50 +0000)
committerEric Wong <e@80x24.org>
Tue, 16 Apr 2024 20:58:52 +0000 (20:58 +0000)
Large string processing + concurrency + caching/memoization
really brings out the worst in glibc malloc :<

Documentation/public-inbox-tuning.pod
examples/public-inbox-netd@.service

index 732461441adb3c6bf7cd27000ba55b5d998c73d6..7d0690b42ad523fac3b428ac4b50a4de0b364a15 100644 (file)
@@ -165,8 +165,11 @@ capacity planning.
 
 Bursts of small object allocations late in process life contribute to
 fragmentation of the heap due to arenas (slabs) used internally by Perl.
-jemalloc (tested as an LD_PRELOAD on GNU/Linux) appears to reduce
+jemalloc (tested as an LD_PRELOAD on GNU/Linux) reduces
 overall fragmentation compared to glibc malloc in long-lived processes.
+glibc malloc users may try setting C<MALLOC_MMAP_THRESHOLD_> to a lower
+value (e.g. 131072) but that may require increasing the
+C<sys.vm.max_map_count> sysctl.
 
 =head2 Other OS tuning knobs
 
index 83d2e995c0f612cd92806c9778ca1609e76520fd..7437f086730a136e7877d9b6083861e656de06e8 100644 (file)
@@ -12,8 +12,11 @@ Wants = public-inbox-netd.socket
 After = public-inbox-netd.socket
 
 [Service]
-# An LD_PRELOAD for libjemalloc can be added here.  It currently seems
+# An LD_PRELOAD for libjemalloc can be added here.  It is
 # more resistant to fragmentation in long-lived daemons than glibc.
+# If you're unable to use jemalloc, setting MALLOC_MMAP_THRESHOLD_
+# to a lower value (e.g. 131072) but that may also require increasing
+# the sys.vm.max_map_count sysctl.
 Environment = PI_CONFIG=/home/pi/.public-inbox/config \
 PATH=/usr/local/bin:/usr/bin:/bin \
 TZ=UTC \