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

Basic Support for Swap #4091

Closed
wants to merge 11 commits into from
Closed

Conversation

tbartelmess
Copy link
Contributor

@tbartelmess tbartelmess commented Mar 31, 2018

This PR adds basic support to make Swap space a schedulable resource. While especially in cloud environments swap usage can be tricky since the performance can vary a lot. However, for some cases that process very ununiform data (especially batch workload), swap is often needed to not over-provision Memory to a great extent that then never ends up being used. At @Marketcircle, we are using a fork of Nomad with those changes.

There are no changes to the documentation yet, and also the metric collection is not finalized.

The main change is that "Swap" is a schedulable resource and can be defined in the resources of a task.

      resources = {
        memory = 2048
        cpu    = 1750
        swap   = 2048
}

Nodes do get fingerprinted for available swap space and the docker and lxc schedulers have been updated to enforce the limit.

api/resources.go Outdated
@@ -66,6 +72,9 @@ func (r *Resources) Merge(other *Resources) {
if other.MemoryMB != nil {
r.MemoryMB = other.MemoryMB
}
if other.SwapMB != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

go fmt

@@ -472,6 +472,7 @@ func parseReserved(result **Resources, list *ast.ObjectList) error {
valid := []string{
"cpu",
"memory",
"swap",
Copy link
Contributor

Choose a reason for hiding this comment

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

go fmt

jobspec/parse.go Outdated
@@ -1199,6 +1199,7 @@ func parseResources(result *api.Resources, list *ast.ObjectList) error {
"iops",
"disk",
"memory",
"swap",
Copy link
Contributor

Choose a reason for hiding this comment

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

go fmt

@@ -1594,6 +1597,9 @@ func (r *Resources) Merge(other *Resources) {
if other.MemoryMB != 0 {
r.MemoryMB = other.MemoryMB
}
if other.SwapMB != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

go fmt

@dadgar
Copy link
Contributor

dadgar commented Apr 2, 2018

@tbartelmess Great job on this PR but unfortunately this is not something we would like in Nomad. The reason being is that when a subset of allocations on a node are using swap, it can lead to degraded performance of the entire node and thus negatively impact the other allocations. In Nomad 0.9 we will be targeting fingerprinter plugins, custom resources and drivers as plugins. With these newer features you will be able to accomplish your goal of making Nomad swap aware without it being in core. Hope my explanation makes sense and that the path forward to not maintaining a fork is acceptable! Thanks again!

@jippi
Copy link
Contributor

jippi commented Apr 22, 2018

@dadgar my 50c on this is to allow the feature, but as a client configuration knob

there are tons of valid cases for needing this, and hiding it behind a flag would nomad team to say we told you it was a terrible idea if someone complains :)

@shantanugadgil
Copy link
Contributor

shantanugadgil commented Apr 22, 2018

I totally agree about letting the user allow swap for dockers as well.
Going through the master CHANGELOG, what is confusing is that Nomad initially (somewhere before v0.4.1 allowed this behavior), which was then changed, not be allowed at all.
Then a feature to allow override the total memory of the client landed recently, which mentions SWAP as one of the possibilities of the feature.

Like @jippi says, I too has imagined that this could be a client/driver option; something like driver.docker.enable_swap, maybe?

@github-actions
Copy link

github-actions bot commented Mar 5, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants