Don't create a NetworkIndex when scheduling jobs that don't use networking
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
Nomad's [`NetworkIndex`](https://pkg.go.dev/github.com/hashicorp/nomad/nomad/structs#NetworkIndex) struct serves 3 purposes during scheduling:
1. Assigning an IP address for each `network.port` stanza
2. Ensuring the job's static ports are not already in use on the node being ranked
3. Choosing an unused port for job's dynamic ports
However we build this index regardless of whether or not a job even requires networking! Not only does this impact performance, but it means any bugs in NetworkIndex (such as #13505) affect jobs which don't even require networking!
Sadly I don't think making computing the NetworkIndex conditional will be straightforward since where we initialize the NetworkIndex and where we check for the existence of `network` stanzas and use the NetworkIndex are spread apart.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing where NetworkIndex is initialized, where network stanzas are checked, and where the index is used during scheduling. Compare the path for jobs without networking against the three NetworkIndex responsibilities described in the issue. Done means non-networked jobs avoid creating the index while networked scheduling retains its existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, infrastructure
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100