Skip to content

Add rank bracket segmentation to benchmarks - #2972

Open
geracosta wants to merge 2 commits into
odota:masterfrom
geracosta:benchmark-brackets
Open

Add rank bracket segmentation to benchmarks#2972
geracosta wants to merge 2 commits into
odota:masterfrom
geracosta:benchmark-brackets

Conversation

@geracosta

Copy link
Copy Markdown
Contributor

Second step of #2969, following what we discussed there: 8 individual brackets, bucketed by the match's avg_rank_tier the same way the hero pick/win counts do it. Matches without avg_rank_tier only feed the global sets, and the default /benchmarks response is unchanged.

Write side: updateBenchmarks zadds the same sampled value into benchmarks:{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=5 reads 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.

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.
Comment thread svc/counts.ts Outdated
),
key,
p.hero_id,
rank,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
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