Add rank bracket segmentation to benchmarks - #2972
Open
geracosta wants to merge 2 commits into
Open
Conversation
Sampled matches also feed a per-bracket zset (1-8 from the match average rank tier, as in the hero pick/win counts) alongside the global one. /benchmarks takes an optional bracket query param to read percentiles against a single bracket; the default response is unchanged and turbo benchmarks stay global-only.
howardchung
reviewed
Aug 9, 2026
| ), | ||
| key, | ||
| p.hero_id, | ||
| rank, |
Member
There was a problem hiding this comment.
Considering that turbo and rank are different dimensions I think it should not reuse the same position in the key. Maybe you can reuse rKey but just add on the bracket?
Contributor
Author
There was a problem hiding this comment.
Done in ff39364 — the bracketed sets now keep the empty global/turbo slot and append the bracket as an extra position: benchmarks:<block>:<metric>:<hero>::<bracket>. On the write side it's literally rkey + ":" + rank, and the read side builds the same suffix.
Turbo and rank are different dimensions, so bracketed sets now keep the empty global slot and add the bracket as an extra position: benchmarks:<block>:<metric>:<hero>::<bracket>
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.
Second step of #2969, following what we discussed there: 8 individual brackets, bucketed by the match's
avg_rank_tierthe same way the hero pick/win counts do it. Matches withoutavg_rank_tieronly feed the global sets, and the default/benchmarksresponse is unchanged.Write side:
updateBenchmarkszadds the same sampled value intobenchmarks:{epoch}:{metric}:{heroId}:{rank}next to the existing global key, with the same expiry cycle. The bracket reuses the trailing key slot (""/"turbo"/"1"-"8"), so turbo stays global-only and there's no collision.Read side:
GET /benchmarks?hero_id=X&bracket=5reads percentiles from the bracketed sets (validated 1-8, 400 otherwise). Omitting the param behaves exactly as today.One thing to be aware of: since benchmarks live only in Redis, the bracketed sets start filling on deploy — bracketed queries will be sparse until the current epoch completes. Nothing to migrate.