Implement best-of-two scheduling - #872
Merged
Merged
Conversation
paulgb
marked this pull request as ready for review
December 10, 2025 19:02
There was a problem hiding this comment.
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.
rolyatmax
approved these changes
Dec 10, 2025
rolyatmax
left a comment
Member
There was a problem hiding this comment.
LGTM once the non-cert tests pass
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.
No description provided.