Skip to content

Commit 4fbf359

Browse files
fix(web): scale web heap limit to container memory (#1569)
* 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) <noreply@anthropic.com> * docs: add changelog entry for web heap limit fix Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * 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) <noreply@anthropic.com> * Remove comment in supervisord configuration --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent eb46976 commit 4fbf359

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- Added a manually triggered cloud image release workflow for isolated internal deployments. [#1566](https://github.com/sourcebot-dev/sourcebot/pull/1566)
1212

13+
### Fixed
14+
- 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)
15+
1316
## [5.1.6] - 2026-08-10
1417

1518
### Added

supervisord.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ redirect_stderr=true
1515

1616
[program:web]
1717
command=./prefix-output.sh node packages/web/server.js
18+
environment=NODE_OPTIONS="--max-old-space-size-percentage=50"
1819
priority=20
1920
autostart=true
2021
autorestart=true
@@ -31,4 +32,4 @@ autorestart=true
3132
startretries=3
3233
stdout_logfile=/dev/fd/1
3334
stdout_logfile_maxbytes=0
34-
redirect_stderr=true
35+
redirect_stderr=true

0 commit comments

Comments
 (0)