fix: reduce in-process cluster memory usage#33
Merged
Conversation
(cherry picked from commit 0308a94f6b65257c8f4a28a5a68c971b882e785b)
(cherry picked from commit 509de2e838f47cadc1934a7156b7a01846d2bc67)
Cluster Performance
Run: workflow run for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I added opt-in heap diagnostics for
clusterandrefresh, then reduced peak memory usage in the in-process clustering path by loading and normalizing one source kind at a time instead of materializing the full parsed embedding cache for the repo up front.What I changed
--heap-snapshot-dirand--heap-log-interval-msto the CLI cluster/refresh flows so I can capture heap snapshots and memory samples during long runs.SIGUSR2heap snapshot hook and lightweight memory logging for cluster investigations.Verification
pnpm --filter ghcrawl test.pnpm --filter @ghcrawl/api-core test.origin/mainwith:pnpm --filter ghcrawl cli cluster openclaw/openclaw --heap-snapshot-dir /tmp/ghcrawl-heaps-origin-main --heap-log-interval-ms 5000Notes
vectorliteexperiment path separately and it still shows the same class of memory problem; I left that follow-up out of this PR to keep the scope tight.