A scrape counts the resources where they already are - #505
Open
bjmeetsfo wants to merge 1 commit into
Open
Conversation
Every Prometheus scrape of the metaserver listed each server, each proxy,
each namespace, each table and each proxy group -- five calls, five times
taking the lock, five copies of a collection -- and then used the lengths
and the states and threw the copies away.
Listing a server copies it whole, and a server carries its shard-load list
and its shard-state list: three strings for every shard it holds. A cluster
of thirty-two datanodes holding a thousand shards each had ninety-six
thousand strings copied to answer how many servers are frozen, on every
scrape, on an interval, forever.
The totals were already gathered where the state is held -- MetaStats
carries them. It now carries the per-state breakdown too, counted in the
same pass, and the per-server and per-proxy numbers the scrape reports come
from a row that has those numbers and nothing else.
servers x shards each before after
8 x 250 372 us 19.2 us
16 x 500 2 360 us 29.9 us
32 x 1 000 8 559 us 44.6 us
A hundred and ninety times faster at the largest, measured before and after
back to back. It also stops growing with the shards: sixteen times the
shard states cost 2.3 times as much rather than 23 times.
A test registers a server in each state and checks the counts read from the
stats are the counts listing them would have produced.
bjmeetsfo
force-pushed
the
oss/a-scrape-counts-where-the-state-is
branch
from
August 31, 2026 08:46
59b5a9c to
089f29a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every Prometheus scrape of the metaserver listed each server, each proxy,
each namespace, each table and each proxy group -- five calls, five times
taking the lock, five copies of a collection -- and then used the lengths
and the states and threw the copies away.
Listing a server copies it whole, and a server carries its shard-load list
and its shard-state list: three strings for every shard it holds. A cluster
of thirty-two datanodes holding a thousand shards each had ninety-six
thousand strings copied to answer how many servers are frozen, on every
scrape, on an interval, forever.
The totals were already gathered where the state is held -- MetaStats
carries them. It now carries the per-state breakdown too, counted in the
same pass, and the per-server and per-proxy numbers the scrape reports come
from a row that has those numbers and nothing else.
A hundred and ninety times faster at the largest, measured before and after
back to back. It also stops growing with the shards: sixteen times the
shard states cost 2.3 times as much rather than 23 times.
A test registers a server in each state and checks the counts read from the
stats are the counts listing them would have produced.