Skip to content

Build scrape list in reverse for better performance - #46

Merged
jessestimpson merged 1 commit into
feature/raw-counter-keysfrom
feature/scrape-formatting
Oct 26, 2026
Merged

jessestimpson merged 1 commit into
feature/raw-counter-keysfrom
feature/scrape-formatting

Conversation

@jessestimpson

Copy link
Copy Markdown
Member

Build list in reverse to avoid O(n^2) complexity.

@jessestimpson

jessestimpson commented Oct 22, 2026 •

Copy link
Copy Markdown
Member Author

get_counters/0, 1 scheduler, one counter with N tag sets

series before after
1,000 2.9 ms 2.1 ms
2,000 7.7 ms 2.9 ms
4,000 24.3 ms 5.7 ms
8,000 97.1 ms 11.1 ms
16,000 n/a 25.2 ms
32,000 n/a 50.2 ms

Full scrape, N counter series + N/10 histograms, written from every scheduler

series schedulers in-process before after HTTP /metrics before after
100 + 10 1 0.17 ms 0.17 ms 1.79 ms 1.92 ms
1,000 + 100 1 2.41 ms 1.52 ms 14.8 ms 14.7 ms
10,000 + 1,000 1 156 ms 17 ms 305 ms 136 ms
10,000 + 1,000 4 171 ms 36 ms 252 ms 120 ms
10,000 + 1,000 18 255 ms 119 ms 344 ms 193 ms

@jessestimpson
jessestimpson force-pushed the feature/scrape-formatting branch from 247c1e0 to 66e255c Compare October 23, 2026 18:37
@jessestimpson
jessestimpson merged commit 2580693 into master Oct 26, 2026
2 checks passed
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.

3 participants