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 memory usage during Alter execution #9301

Merged
merged 1 commit into from
Feb 6, 2025
Merged

Reduce memory usage during Alter execution #9301

merged 1 commit into from
Feb 6, 2025

Conversation

mangalaman93
Copy link
Member

We currently use y.Throttle type to ensure that we do not concurrently build indexes for many predicates at the same time to avoid opening too many files on disk. This type allocates large memory initially to achieve this. By default, on my machine we allocate 128 MB of memory every time Alter is called. Now, Go is slow to release this memory back to OS increasing the memory usage.

This PR sets the max to 1024 predicates at a time. It would be lower if Alter request involves fewer predicates in the request

We currently use y.Throttle type to ensure that
we do not concurrently build indexes for many
predicates at the same time to avoid opening
too many files on disk. This type allocates large
memory initially to achieve this. By default, on
my machine we allocate 128 MB of memory every time
Alter is called. Now, Go is slow to release this
memory back to OS increasing the memory usage.

This PR sets the max to 1024 predicates at a time.
It would be lower if Alter request involves fewer
predicates in the request
@mangalaman93 mangalaman93 requested a review from a team as a code owner February 6, 2025 09:24
@github-actions github-actions bot added area/core internal mechanisms go Pull requests that update Go code labels Feb 6, 2025
Copy link

trunk-io bot commented Feb 6, 2025

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@mangalaman93 mangalaman93 enabled auto-merge (squash) February 6, 2025 12:51
@mangalaman93 mangalaman93 merged commit 6380120 into main Feb 6, 2025
14 checks passed
@mangalaman93 mangalaman93 deleted the aman/mem branch February 6, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core internal mechanisms go Pull requests that update Go code
Development

Successfully merging this pull request may close these issues.

2 participants