Skip to content

Reduce memory usage during Alter execution#9301

Merged
mangalaman93 merged 1 commit intomainfrom
aman/mem
Feb 6, 2025
Merged

Reduce memory usage during Alter execution#9301
mangalaman93 merged 1 commit intomainfrom
aman/mem

Conversation

@mangalaman93
Copy link
Contributor

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 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
@trunk-io
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.

1 participant