about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-04-15 19:50:56 +0000
committerEric Wong <e@80x24.org>2024-04-16 20:58:52 +0000
commitcd14eec87ae870f388ac24c2390e1c608fbed99c (patch)
tree6b90aea9e7b4bf0225050066db8731db98e7c47d
parent6543902ed6d596f86bdbe863c4d2a9c168b3f3df (diff)
downloadpublic-inbox-cd14eec87ae870f388ac24c2390e1c608fbed99c.tar.gz
Large string processing + concurrency + caching/memoization
really brings out the worst in glibc malloc :<
-rw-r--r--Documentation/public-inbox-tuning.pod5
-rw-r--r--examples/public-inbox-netd@.service5
2 files changed, 8 insertions, 2 deletions
diff --git a/Documentation/public-inbox-tuning.pod b/Documentation/public-inbox-tuning.pod
index 73246144..7d0690b4 100644
--- a/Documentation/public-inbox-tuning.pod
+++ b/Documentation/public-inbox-tuning.pod
@@ -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
 
diff --git a/examples/public-inbox-netd@.service b/examples/public-inbox-netd@.service
index 83d2e995..7437f086 100644
--- a/examples/public-inbox-netd@.service
+++ b/examples/public-inbox-netd@.service
@@ -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 \