feat(ci): two-tier test split with service classification#115434
Draft
mchen-sentry wants to merge 8 commits into
Draft
feat(ci): two-tier test split with service classification#115434mchen-sentry wants to merge 8 commits into
mchen-sentry wants to merge 8 commits into
Conversation
- service_classifier.py: hybrid static + runtime classification plugin that maps each test to its service dependencies (Snuba, Kafka, etc.) - classify-services.yml: workflow to generate classification across 22 shards - split-tests-by-tier.py: splits classification into tier1 (postgres-only) and tier2 (full Snuba stack) test lists - backend.yml: add split-tiers + backend-light jobs, wire backend-test to use tier2 list when classification is available - Selective testing (PRs) and tiers (master) are mutually exclusive
Hybrid distribution mode based on experiment data: --dist=load cuts tier 2 shard-time variance by 54% (179s -> 82s spread) by load-balancing individual tests across workers, but hurts tier 1 (where small fast tests benefit from fixture reuse via loadfile). Apply load only when tiers are active. Backend-test without tiers (selective PRs, master without classification) keeps --dist=loadfile for backwards compatibility.
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.
Tests that don't use Snuba still pay full Snuba startup cost (~50s/shard) today. This splits the suite into tier1 (postgres-only, 5 shards, no Snuba) and tier2 (full stack, 17 shards) — same 22 total shards, but tier1 shards finish in ~12m instead of ~18m.
The split is driven by a
classify-servicesworkflow (run once per branch, on-demand) that instruments each test's socket calls and fixture markers to map files to their service dependencies. The result is stored as an artifact and consumed by thesplit-tiersjob on each backend run.service_classifier.py: pytest plugin — monkey-patchessocket.send/sendallduring test runs to detect which services each test actually contacts, combined with static fixture marker inspectionclassify-services.yml: runs classification across 22 shards and merges resultssplit-tests-by-tier.py: splits the merged JSON into tier1/tier2 file listsbackend-lightjob: 5 shards with only postgres + redis-cluster + kafka (no Snuba devservices), uses--dist=loadfilebackend-testdrops to 17 shards when tiers are active, uses--dist=loadfor tier2 (snuba-heavy tests have higher per-test variance)