From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] doc: note MALLOC_MMAP_THRESHOLD_ as a potential workaround
Date: Mon, 15 Apr 2024 19:50:56 +0000 [thread overview]
Message-ID: <20240415195056.2017968-1-e@80x24.org> (raw)
Large string processing + concurrency + caching/memoization
really brings out the worst in glibc malloc :<
---
Documentation/public-inbox-tuning.pod | 5 ++++-
examples/public-inbox-netd@.service | 5 ++++-
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 \
reply other threads:[~2024-04-15 19:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240415195056.2017968-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).