* SHA-256 coderepos are fully supported (but not inboxes, yet)
- * jemalloc (tested as an LD_PRELOAD) is recommended to reduce fragmentation
- in long-running daemon processes serving unpredictable traffic
+ * for daemons serving public traffic, MALLOC_MMAP_THRESHOLD_=131072 is
+ recommended to reduce fragmentation in glibc malloc, while jemalloc
+ (tested as an LD_PRELOAD) is another option.
PublicInbox::WWW
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) 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.
+glibc malloc users should use C<MALLOC_MMAP_THRESHOLD_=131072> to reduce
+fragmentation from the sliding mmap window. jemalloc (tested as an
+LD_PRELOAD on GNU/Linux) also reduces fragmentation compared to an
+unconfigured glibc malloc in long-lived processes.
=head2 Other OS tuning knobs
Environment = PI_CONFIG=/home/pi/.public-inbox/config \
PATH=/usr/local/bin:/usr/bin:/bin \
TZ=UTC \
+MALLOC_MMAP_THRESHOLD_=131072 \
PERL_INLINE_DIRECTORY=/tmp/.pub-inline
LimitNOFILE = 30000
[Service]
Environment = PI_CONFIG=/home/pi/.public-inbox/config \
PATH=/usr/local/bin:/usr/bin:/bin \
+TZ=UTC \
+MALLOC_MMAP_THRESHOLD_=131072 \
PERL_INLINE_DIRECTORY=/tmp/.pub-inline
LimitNOFILE = 30000
After = public-inbox-netd.socket
[Service]
-# 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.
+
+# Setting MALLOC_MMAP_THRESHOLD_=131072 reduces fragmentation by
+# disabling the sliding mmap window in glibc malloc. An LD_PRELOAD for
+# libjemalloc may be added here, instead. jemalloc is more resistant to
+# fragmentation in long-lived daemons than unconfigured glibc malloc.
Environment = PI_CONFIG=/home/pi/.public-inbox/config \
PATH=/usr/local/bin:/usr/bin:/bin \
TZ=UTC \
+MALLOC_MMAP_THRESHOLD_=131072 \
PERL_INLINE_DIRECTORY=/tmp/.netd-inline
LimitNOFILE = 30000
[Service]
Environment = PI_CONFIG=/home/pi/.public-inbox/config \
PATH=/usr/local/bin:/usr/bin:/bin \
+TZ=UTC \
+MALLOC_MMAP_THRESHOLD_=131072 \
PERL_INLINE_DIRECTORY=/tmp/.pub-inline
LimitNOFILE = 30000