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

core: plumbing to support numa aware scheduling #18681

Merged
merged 3 commits into from
Oct 19, 2023
Merged

core: plumbing to support numa aware scheduling #18681

merged 3 commits into from
Oct 19, 2023

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Oct 6, 2023

This PR contains the bulk of implementation for NUMA-aware scheduling, a feature coming for Nomad Enterprise 1.7. See NMD-187 (internal) for details.

The CE specific bits are in nomad/job_endpoint_hook_numa_ce.go and scheduler/numa_ce.go.

Note: e2e, documentation, changelog, etc. will be in followup PRs.

Overview of changes

  • add support for task.resources.numa.affinity = <string>
  • client fingerprint of NUMA topology is now pushed to the server's NodeResources
  • use of the client's deprecated CpuResources is removed except for client<->server upgrade compatibility
  • jobspec validation prohibits setting resources.numa in CE
  • jobspec diff handles resources.numa
  • mock package now provides MockBasicTopology() to be used instead of manually setting cpu resources in tests
  • scheduler provides coreSelector.Select() (for CE here) for choosing cpu cores in the same way as they were previously
  • ^ which is used for selecting cores in RankNode

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

This looks great @shoenig! I've left some questions about a few bits I'm unsure of.

Comment on lines +3123 to +3125
// Compatibility will translate the LegacyNodeCpuResources into NodeProcessor
// Resources, or the other way around as needed.
func (n *NodeResources) Compatibility() {
Copy link
Member

Choose a reason for hiding this comment

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

When servers are upgraded before clients, the old clients will be transmitting the old fingerprints but that only happens if they have a new fingerprint to send (not on heartbeat). And the scheduler won't typically call Copy or Merge, so if we upgrade and then dequeue an eval that reads an old node before we read that new fingerprint then the node won't have these compatibility updates.

So maybe we could call this from FSM restore, so that we immediately fix-up anything that's in Raft. I think that would also let us move this into a Canonicalize method on Node as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh nice catch; added a call to Compatibility() inside Node.Canonicalize() in e79311c

command/node_status.go Show resolved Hide resolved
scheduler/rank.go Show resolved Hide resolved
Handle the case where an upgraded server dequeus an evaluation before
a client triggers a new fingerprint - which would be needed to cause
the compatibility fix to run. By running the compat fix on restore the
server will immediately have the compatible pseudo topology to use.
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work!

@shoenig shoenig merged commit 8372074 into main Oct 19, 2023
24 of 25 checks passed
@shoenig shoenig deleted the numa-support-ce branch October 19, 2023 20:09
nvanthao pushed a commit to nvanthao/nomad that referenced this pull request Mar 1, 2024
* core: plumbing to support numa aware scheduling

* core: apply node resources compatibility upon fsm rstore

Handle the case where an upgraded server dequeus an evaluation before
a client triggers a new fingerprint - which would be needed to cause
the compatibility fix to run. By running the compat fix on restore the
server will immediately have the compatible pseudo topology to use.

* lint: learn how to spell pseudo
nvanthao pushed a commit to nvanthao/nomad that referenced this pull request Mar 1, 2024
* core: plumbing to support numa aware scheduling

* core: apply node resources compatibility upon fsm rstore

Handle the case where an upgraded server dequeus an evaluation before
a client triggers a new fingerprint - which would be needed to cause
the compatibility fix to run. By running the compat fix on restore the
server will immediately have the compatible pseudo topology to use.

* lint: learn how to spell pseudo
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