Skip to content

fix(ci): cap bulk_snuba_queries thread pool to 4 under per-worker Snuba#114105

Closed
mchen-sentry wants to merge 1 commit into
masterfrom
mchen/ci-snuba-pool-cap
Closed

fix(ci): cap bulk_snuba_queries thread pool to 4 under per-worker Snuba#114105
mchen-sentry wants to merge 1 commit into
masterfrom
mchen/ci-snuba-pool-cap

Conversation

@mchen-sentry
Copy link
Copy Markdown
Member

We're seeing flakes in backend tests using bulk_snuba_queries because the default thread pool of 10 fans out wider than Snuba's CrossOrgQueryAllocationPolicy on the errors storage allows (rejection_threshold=4 in CI). The 5th concurrent query gets rejected with RateLimitExceeded. Cap the pool to 4 when XDIST_PER_WORKER_SNUBA=1 so we never exceed the policy. Production keeps the wider pool of 10 since prod has higher thresholds.

@mchen-sentry mchen-sentry requested review from a team as code owners April 27, 2026 23:29
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 27, 2026
@mchen-sentry mchen-sentry requested a review from joshuarli April 27, 2026 23:36
Comment thread src/sentry/utils/snuba.py Outdated
Per-worker Snuba in CI runs with CrossOrgQueryAllocationPolicy capped at 4
concurrent queries on the errors storage. The default ThreadPoolExecutor of 10
workers fans out wide enough to hit the policy and surface flakes (notably in
backfill_supergroups_lightweight). Cap the pool to 4 when XDIST_PER_WORKER_SNUBA=1
so we never exceed the policy. Production keeps the wider pool of 10 since prod
allocation thresholds are higher.

Also updates docs/tiered-split-problems.md to note the PR breakdown.
@mchen-sentry mchen-sentry force-pushed the mchen/ci-snuba-pool-cap branch from 4db337e to 1947ef0 Compare April 28, 2026 17:39
@mchen-sentry mchen-sentry requested a review from a team as a code owner April 28, 2026 17:39
@JoshFerge
Copy link
Copy Markdown
Member

could we just change snubas rate limits in tests instead?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants