Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assignedNodeId field to JobSchedulingContext #3678

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

JamesMurkin
Copy link
Contributor

This makes it far faster to look up the currently assigned node for a given evicted job

  • Currently it uses a map look up which is comparatively slow

This makes it far faster to look up the currently assigned node for a given evicted job
 - Currently it uses a map look up which is comparatively slow

Signed-off-by: JamesMurkin <[email protected]>
Signed-off-by: JamesMurkin <[email protected]>
Signed-off-by: JamesMurkin <[email protected]>
@JamesMurkin JamesMurkin marked this pull request as ready for review June 17, 2024 12:13
JamesMurkin added a commit that referenced this pull request Jun 17, 2024
Testing with the worst case, this makes the function 2-4 times faster
 - Combined with #3678 it is about 3-5 times faster

Even the average case should be improved, as we now do less work

The main "trick" here is to not perform node.UnsafeCopy() and nodeDb.unbindJobFromNodeInPlace until it is needed (once you know which node is the selected one)
 - These functions are expensive, particularly UnsafeCopy

Instead just keep track of the evicted nodes + available resource locally until you've found one that matches.

There are more enhancements that could be made here:
 - Work out when it is better to check static requirements first (possibly even save these and use them for all jobs with the same scheduling key)
 - Improve nodeDb speed to look up a node (use a map?)
 - Improve nodeDb speed to iterate evicted jobs (use a slice? / effectively we just need a sorted hashmap, not a fully fledged radix tree)

Signed-off-by: JamesMurkin <[email protected]>
@JamesMurkin JamesMurkin enabled auto-merge (squash) June 20, 2024 21:34
@JamesMurkin JamesMurkin merged commit 98c4dec into master Jun 20, 2024
20 checks passed
@JamesMurkin JamesMurkin deleted the assigned_node_field branch June 20, 2024 21:44
JamesMurkin added a commit that referenced this pull request Jun 21, 2024
* Improve performance of selectNodeForJobWithFairPreemption

Testing with the worst case, this makes the function 2-4 times faster
 - Combined with #3678 it is about 3-5 times faster

Even the average case should be improved, as we now do less work

The main "trick" here is to not perform node.UnsafeCopy() and nodeDb.unbindJobFromNodeInPlace until it is needed (once you know which node is the selected one)
 - These functions are expensive, particularly UnsafeCopy

Instead just keep track of the evicted nodes + available resource locally until you've found one that matches.

There are more enhancements that could be made here:
 - Work out when it is better to check static requirements first (possibly even save these and use them for all jobs with the same scheduling key)
 - Improve nodeDb speed to look up a node (use a map?)
 - Improve nodeDb speed to iterate evicted jobs (use a slice? / effectively we just need a sorted hashmap, not a fully fledged radix tree)

Signed-off-by: JamesMurkin <[email protected]>

* Lint

Signed-off-by: JamesMurkin <[email protected]>

* Move struct definition inside function

Signed-off-by: JamesMurkin <[email protected]>

---------

Signed-off-by: JamesMurkin <[email protected]>
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