From 22aec53fe91f568029aabf3780ce0c5dd700e87d Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Tue, 11 Aug 2026 14:33:14 -0700 Subject: [PATCH 1/4] fix(web): scale web heap limit to container memory Node's default old-space limit caps at ~4GiB regardless of how much memory the container actually has. On larger deployments the web process fills that ceiling and V8 falls into back-to-back full mark-compact collections, which block the event loop for seconds at a time and slow every route at once. Set --max-old-space-size-percentage on the web program so the heap scales with the container's memory limit. Node reads the cgroup limit, so this is proportional on every deployment size. Scoped to [program:web] via supervisord so the backend and zoekt are unaffected. Co-Authored-By: Claude Opus 5 (1M context) --- supervisord.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervisord.conf b/supervisord.conf index 572136331..aae971807 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -15,6 +15,8 @@ redirect_stderr=true [program:web] command=./prefix-output.sh node packages/web/server.js +# Node's default heap limit caps at ~4GiB regardless of container memory. +environment=NODE_OPTIONS="--max-old-space-size-percentage=75" priority=20 autostart=true autorestart=true From 3a76dcdf9c548514143ce387c79669792899e8fb Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Tue, 11 Aug 2026 14:35:33 -0700 Subject: [PATCH 2/4] docs: add changelog entry for web heap limit fix Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b5bb986..ff5090ed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added a manually triggered cloud image release workflow for isolated internal deployments. [#1566](https://github.com/sourcebot-dev/sourcebot/pull/1566) +### Fixed +- Fixed the web process being capped at a ~4GiB heap regardless of how much memory the container has, which caused multi-second garbage collection pauses on larger deployments. [#1569](https://github.com/sourcebot-dev/sourcebot/pull/1569) + ## [5.1.6] - 2026-08-10 ### Added From 2e2e2ee83b4448591f154a8cc42bfe9ea7fd90a5 Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Tue, 11 Aug 2026 15:02:22 -0700 Subject: [PATCH 3/4] fix(web): use 50% rather than 75% for the web heap limit At a 16GiB limit this gives the web process an 8384MiB ceiling (up from 4288MiB), which still resolves the GC thrash while leaving roughly 7.7GiB for page cache. zoekt currently uses ~5.8GiB of file cache for its EFS-backed index, and 75% would have squeezed that to ~3.6GiB. 50% also matches Node's own default curve below the ~4GiB cap, so deployments at or under 8GiB are unaffected by this change. Co-Authored-By: Claude Opus 5 (1M context) --- supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisord.conf b/supervisord.conf index aae971807..e63205a24 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -16,7 +16,7 @@ redirect_stderr=true [program:web] command=./prefix-output.sh node packages/web/server.js # Node's default heap limit caps at ~4GiB regardless of container memory. -environment=NODE_OPTIONS="--max-old-space-size-percentage=75" +environment=NODE_OPTIONS="--max-old-space-size-percentage=50" priority=20 autostart=true autorestart=true From b27910ba8dab8f3b0f933cac271f2f57abf9ed3a Mon Sep 17 00:00:00 2001 From: Brendan Kellam Date: Tue, 11 Aug 2026 15:03:46 -0700 Subject: [PATCH 4/4] Remove comment in supervisord configuration --- supervisord.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/supervisord.conf b/supervisord.conf index e63205a24..8d813004e 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -15,7 +15,6 @@ redirect_stderr=true [program:web] command=./prefix-output.sh node packages/web/server.js -# Node's default heap limit caps at ~4GiB regardless of container memory. environment=NODE_OPTIONS="--max-old-space-size-percentage=50" priority=20 autostart=true @@ -33,4 +32,4 @@ autorestart=true startretries=3 stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 -redirect_stderr=true \ No newline at end of file +redirect_stderr=true