Skip to content

Implement best-of-two scheduling - #872

Merged
paulgb merged 8 commits into
mainfrom
paulgb/best-of-two-scheduling
Dec 10, 2025
Merged

Implement best-of-two scheduling#872
paulgb merged 8 commits into
mainfrom
paulgb/best-of-two-scheduling

Conversation

@paulgb

@paulgb paulgb commented Dec 10, 2025

Copy link
Copy Markdown
Member

No description provided.

@paulgb
paulgb requested a review from rolyatmax December 10, 2025 19:02
@paulgb
paulgb marked this pull request as ready for review December 10, 2025 19:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR implements the "power of two choices" (best-of-two) load balancing algorithm for drone selection, replacing the previous approach that sorted all drones by backend count. The new algorithm randomly selects two candidate drones and chooses the one with the lowest backend count, providing nearly optimal load distribution with better performance characteristics.

Key changes:

  • Modified SQL query to return 2 random drones with their backend counts instead of 1 pre-sorted drone
  • Implemented application-side selection of the drone with minimum backend count from the two candidates
  • Added reference to academic paper documenting the best-of-two scheduling approach
Files not reviewed (2)
  • plane/.sqlx/query-7cd9d4b058691049f957bb1b03acda2eaa755c20798f2f744fe51ba92c2d295b.json: Language not supported
  • plane/.sqlx/query-cc4bc25932348053c5772632c5be3b9ee1e6a73798340d11950486cc16a6c81c.json: Language not supported

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

Comment thread plane/src/database/drone.rs
Comment thread plane/src/database/drone.rs
Comment thread plane/src/database/drone.rs

@rolyatmax rolyatmax left a comment

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.

LGTM once the non-cert tests pass

@paulgb
paulgb merged commit f027066 into main Dec 10, 2025
3 of 4 checks passed
@paulgb
paulgb deleted the paulgb/best-of-two-scheduling branch December 10, 2025 20:18
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.

3 participants