Skip to content

perf(dynamic-sampling): Skip orgs without active projects in per-org scheduler#119889

Merged
shellmayr merged 4 commits into
masterfrom
perf/ds-scheduler-skip-orgs-without-projects
Jul 21, 2026
Merged

perf(dynamic-sampling): Skip orgs without active projects in per-org scheduler#119889
shellmayr merged 4 commits into
masterfrom
perf/ds-scheduler-skip-orgs-without-projects

Conversation

@shellmayr

@shellmayr shellmayr commented Jul 17, 2026

Copy link
Copy Markdown
Member
  • We should be frugal with the amount of tasks spawned
  • Remove orgs that don't have any projects from the scheduling, so they don't even spawn the subtasks, saving tasks & queries

…scheduler

The per-org scheduler dispatched a task for every active org, and orgs without active projects early-returned as no-ops. Filter them out via a semi-join in the scheduler queryset, evaluated once per cycle when the PK snapshot is taken.
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 17, 2026
@shellmayr
shellmayr marked this pull request as ready for review July 17, 2026 08:56
@shellmayr
shellmayr requested a review from a team as a code owner July 17, 2026 08:56
Comment thread src/sentry/dynamic_sampling/per_org/scheduler.py
…lter

Replaces the id__in subquery with a correlated Exists per review suggestion, so Postgres can short-circuit per organization instead of materializing all active project org ids.
@shellmayr
shellmayr requested a review from vgrozdanic July 21, 2026 06:22
@shellmayr
shellmayr merged commit 59f2a50 into master Jul 21, 2026
66 checks passed
@shellmayr
shellmayr deleted the perf/ds-scheduler-skip-orgs-without-projects branch July 21, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants