Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce size of object pool #2028

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Reduce size of object pool #2028

merged 2 commits into from
Sep 20, 2023

Conversation

javierhonduco
Copy link
Contributor

@javierhonduco javierhonduco commented Sep 19, 2023

512 elf.Files (+ other metadata) can really balloon memory usage. Assuming
each entry is ~10 MB would result in a heap usage of at least 5 GB. Some
of our users reported 10 GB in heap usage in the pool which is
completely unreasonable.

In the future we want to update this to have an adaptive mechanism so we
can use the cache as much as possible while keeping memory usage at bay.

Right now having a pool to small will result in more files being opened,
(elf.Open) which results in lots of allocations and high CPU usage.
Hence we have a tradeoff of CPU + allocations vs heap usage.

Test Plan

Ran overnight without issues.

Signed-off-by: Francisco Javier Honduvilla Coto javierhonduco@gmail.com

@javierhonduco
Copy link
Contributor Author

Only land after #2031 as it fixes a race condition that we believe it was affecting the stability of the object pool

@kakkoyun
Copy link
Member

@javierhonduco FYI, There is a formatting issue that causes CI to fail.

512 elf.Files (+ other metadata) can really balloon memory usage. Assuming
each entry is ~10 MB would result in a heap usage of at least 5 GB. Some
of our users reported 10 GB in heap usage in the pool which is
completely unreasonable.

In the future we want to update this to have an adaptive mechanism so we
can use the cache as much as possible while keeping memory usage at bay.

Right now having a pool to small will result in more files being opened,
(elf.Open) which results in lots of allocations and high CPU usage.
Hence we have a tradeoff of CPU + allocations vs heap usage.

Test Plan
=========

Ran overnight without issues.

Signed-off-by: Francisco Javier Honduvilla Coto <javierhonduco@gmail.com>
@javierhonduco javierhonduco marked this pull request as ready for review September 20, 2023 09:11
@javierhonduco javierhonduco requested a review from a team as a code owner September 20, 2023 09:11
@javierhonduco
Copy link
Contributor Author

Helpful bot 😛

@kakkoyun kakkoyun enabled auto-merge (squash) September 20, 2023 09:24
@kakkoyun kakkoyun merged commit f3a911e into main Sep 20, 2023
22 checks passed
@kakkoyun kakkoyun deleted the reduce-size-of-object-pool branch September 20, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants