Skip to content

aurora: throttle on threads#880

Draft
morgo wants to merge 3 commits into
block:mainfrom
morgo:aurora-throttler
Draft

aurora: throttle on threads#880
morgo wants to merge 3 commits into
block:mainfrom
morgo:aurora-throttler

Conversation

@morgo
Copy link
Copy Markdown
Collaborator

@morgo morgo commented May 25, 2026

A Pull Request should be associated with an Issue.

We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
and potentially we'll be able to point development in a particular direction.
Further notes in https://github.com/block/spirit/blob/main/.github/CONTRIBUTING.md

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Aurora-specific throttling capabilities by introducing dedicated throttlers for Aurora commit latency and Aurora “active CPU threads”, plus shared setup wiring that opens a small separate monitoring connection pool to avoid interference with the main migration workload.

Changes:

  • Introduce throttler.AuroraSetup to probe for Aurora and assemble Aurora throttlers using a lazily-opened monitor *sql.DB.
  • Add two new Aurora throttlers: commit-latency (from performance_schema.global_status) and active-threads (from performance_schema.threads + events_waits_current), each with background polling.
  • Update migration runner throttler setup to use the shared Aurora setup and to manage a dedicated monitorDB lifecycle.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/throttler/aurora.go Adds shared Aurora detection + throttler construction helper that returns throttlers + a dedicated monitor pool.
pkg/throttler/aurora_test.go Tests AuroraSetup “no-op” behavior when disabled, non-Aurora, or probe fails.
pkg/throttler/aurora_commitlatency.go Implements commit-latency throttler based on Aurora global status counters with delta-based averaging.
pkg/throttler/aurora_commitlatency_test.go Unit tests for commit-latency sampling, throttling transitions, and BlockWait behavior.
pkg/throttler/aurora_activethreads.go Implements active-threads throttler using perf-schema thread/wait data and vCPU threshold.
pkg/throttler/aurora_activethreads_test.go Unit tests for active-threads sampling logic, BlockWait behavior, and probe.
pkg/migration/runner.go Wires Aurora throttlers via AuroraSetup, adds monitorDB pool, and ensures it’s closed appropriately.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/migration/runner.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Comment thread pkg/throttler/aurora.go
Comment thread pkg/throttler/aurora.go Outdated
Comment thread pkg/throttler/aurora_activethreads.go
Comment thread pkg/throttler/aurora_activethreads.go Outdated
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