-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cpu_hard_limit and cpu_cfs_period options
Nomad's docker driver allows having nomad set cpu resources as hard limits rather than soft limits via the `cpu_hard_limits` driver config option. This is useful to restrict how much CPU time a nomad job is permitted to consume, even if the host is under utilised, or when predicatibility is more important than speed. Default behaviour is unchanged. When `cpu_hard_limit` is set to `true` the podman container is started with the equivalent API options to the podman cli `--cpu-quota` and `--cpu-period`. Nomad currently provides a `PercentTicks` value which is used to convert the cpu resource from the specification into a number of microseconds of cputime the job is allowed to consume for each `period` interval of time. Use of this value is discouraged ouside of the docker driver, however the desired long term replacement is to expose `cpu quota` and `cpu period` as options in the task `resource` block, and these are not yet currently exposed. Since this driver emulates the docker interface where possible, I think it's acceptable to use the `PercentTicks` value in spite of the warning to the contrary. The `cpu_cfs_period` defaults to 100,000 (microseconds) in both the linux kernel, and this driver when not specified by the user. User may override this between 1,000 and 1,000,000. Any value less than 1,000 is silently increased to 1,000 to prevent the job failing to run with an `Invalid Operation` error. The minimum value for the quota is also 1,000. Since this value is computed by this driver, it is silently increased to 1,000 if the computed value is lower. For jobs with very small cpu resources in the job spec, which equate to less than 1% of total available cpu, the job may consume more cpu time than intended.
- Loading branch information
Showing
5 changed files
with
151 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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