From d1a1516ada78c81a5a9a7a1d68d84535aa862082 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 20 Oct 2023 11:33:42 +0200 Subject: [PATCH] Set env var to make synit-pid1 and syndicate-server keep their heaps small --- packaging/packages/synit-config/files/sbin/synit-init.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/packages/synit-config/files/sbin/synit-init.sh b/packaging/packages/synit-config/files/sbin/synit-init.sh index 75d855d..c2d2eb5 100755 --- a/packaging/packages/synit-config/files/sbin/synit-init.sh +++ b/packaging/packages/synit-config/files/sbin/synit-init.sh @@ -31,4 +31,11 @@ mkdir -p /usr/local/etc/syndicate/services # usb0. Instead we will be a DHCP client. (This was just easiest to set up.) killall unudhcpd || true +# This tells Rust programs built with jemallocator to be very aggressive about keeping their +# heaps small. Synit currently targets small machines. Without this, I have seen the system +# syndicate-server take around 300MB of heap when doing not particularly much; with this, it +# takes about 15MB in the same state. There is a performance penalty on being so aggressive +# about heap size, but it's more important to stay small in this circumstance right now. +export _RJEM_MALLOC_CONF="narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0" + exec /sbin/synit-pid1