Fix increased memory usage in sysinfo since Router 1.59.0 (backport #6634)#6641
Closed
mergify[bot] wants to merge 1 commit into1.59.2from
Closed
Fix increased memory usage in sysinfo since Router 1.59.0 (backport #6634)#6641mergify[bot] wants to merge 1 commit into1.59.2from
sysinfo since Router 1.59.0 (backport #6634)#6641mergify[bot] wants to merge 1 commit into1.59.2from
Conversation
(cherry picked from commit 4c41b28)
6 tasks
|
@mergify[bot]: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
Collaborator
|
|
CI performance tests
|
nmoutschen
approved these changes
Jan 24, 2025
Contributor
|
Moved to #6643 with me as author to satisfy CLAbot |
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.
In version 1.59.0, Apollo Router started using the
sysinfocrate to gather metrics about available CPUs and RAM. By default, that crate usesrayoninternally to parallelize its handling of system processes. In turn, rayon creates a pool of long-lived threads.In a particular benchmark on a 32-core Linux server, this caused resident memory use to increase by about 150 MB. This is likely a combination of stack space (which only gets freed when the thread terminates) and per-thread space reserved by the heap allocator to reduce cross-thread synchronization cost.
This regression is now fixed by:
sysinfo’s use ofrayon, so the thread pool is not created and system processes information is gathered in a sequential loop.sysinfonot gather that information in the first place since Router does not use it.Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
This is an automatic backport of pull request #6634 done by [Mergify](https://mergify.com).
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩