Skip to content

chore(blooms): Reduce memory footprint of download queue #18242

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

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Jun 26, 2025

The download queue has a fixed size of 100k elements and is implemented using a channel. Since the channel has a fixed size, this will allocate capacity * object size, where the object is downloadRequest[BlockRef, BlockDirectory].

This PR changes the channel from a channel of objects (chan downloadRequest[T, R]) to a channel of pointers (chan *downloadRequest[T, R]) which should significantly reduce the permanently allocated memory for the queue.

The screenshots shows a 3h memory profile (inuse space) of a set of index gateways, where the bloomshipper.newDownloadQueue occupies almost a quarter of the inuse memory.

screenshot_20250626_092853

The download queue has a fixed size of 100k elements and is implemented
using a channel. Since the channel has a fixed size, this will allocate
`capacity * object size`, where the object is `downloadRequest[BlockRef,
BlockDirectory]`.

This PR changes the channel from a channel of objects (`chan
downloadRequest[T, R]`) to a channel of pointers (`chan
*downloadRequest[T, R]`) which should significantly reduce the
permanently allocated memory for the queue.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
@chaudum chaudum requested a review from a team as a code owner June 26, 2025 07:32
@chaudum chaudum merged commit 66c4839 into main Jun 26, 2025
113 of 117 checks passed
@chaudum chaudum deleted the chaudum/bloomfetcher-download-queue branch June 26, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 participants