Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@fxrlv
Copy link
Contributor

@fxrlv fxrlv commented Sep 3, 2025

Describe Your Changes

These changes reduce allocation rate and gc pressure by about 10%.

sum(rate(go_memstats_alloc_bytes_total{job="vmselect"}[5m]))
Screenshot 2025-09-03 at 13 04 34

sum(rate(go_gc_cpu_seconds_total{job="vmselect"}[5m]))
Screenshot 2025-09-03 at 13 08 30

Our setup:
vmselect v1.120.0-cluster 14 pods x 15CPU x 60Gi configured with 100 vmstorage nodes
~ 500rps mostly alerting and recording rules

Checklist

The following checks are mandatory:

@fxrlv
Copy link
Contributor Author

fxrlv commented Sep 3, 2025

btw starting from go1.22 allocating maxFastAllocBlockSize bytes doesn't go to the per-P cache

// Go uses fast allocations for block sizes up to 32Kb.
//
// See https://github.com/golang/go/blob/704401ffa06c60e059c9e6e4048045b4ff42530a/src/runtime/malloc.go#L11
const maxFastAllocBlockSize = 32 * 1024

according to the issue golang/go#75209 (comment) there are no plans to restore this behavior
using the per-P cache allocating this size has no performance benefits. maybe even the opposite effect

cc @valyala

@f41gh7 f41gh7 requested review from f41gh7 and rtm0 September 3, 2025 13:17
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.97%. Comparing base (faeabfc) to head (8a17ffb).
⚠️ Report is 3949 commits behind head on cluster.

Files with missing lines Patch % Lines
app/vmselect/netstorage/netstorage.go 0.00% 23 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           cluster    #9673      +/-   ##
===========================================
- Coverage    59.08%   52.97%   -6.11%     
===========================================
  Files          416      532     +116     
  Lines        78511    86388    +7877     
===========================================
- Hits         46385    45763     -622     
- Misses       29567    38190    +8623     
+ Partials      2559     2435     -124     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@f41gh7
Copy link
Contributor

f41gh7 commented Sep 30, 2025

Could you please provide results of test Benchmarks with improved memory allocations? Or add a new Benchmark to validate this change.

@fxrlv
Copy link
Contributor Author

fxrlv commented Nov 21, 2025

Or add a new Benchmark to validate this change.

Happy to add a new one. Could you help me with what it might look like?

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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.