-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
During a large volume dispatch load test, I discovered that a lot of the total scheduling time is being spent calling structs.ParsePortRanges
repeatedly, in order to parse the reserved ports configuration of the node (ex. converting "80,8000-8001"
to []int{80, 8000, 8001}
).
In this test, the schedulers were being given a large number of evaluations that could not be placed due to capacity. As a result, this shifts the balance of CPU consumption towards scheduling and makes the cost of this more obvious. See the flamegraph below. Most of that usage is from scheduling or Go garbage collection, as we’d expect. What’s not expected is the portion of that scheduling time spent parsing reserved port ranges on the node, even though the workload doesn’t request network port resources.

An initial investigation suggests that Nomad could improve this by memoizing the expensive parsing portion for each node. Ideally we'd do it once during node registration and never have to do it again in the scheduler.
Internal ref: https://hashicorp.atlassian.net/browse/NMD-942