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

Adding support for memory swap settings for services #37872

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wk8
Copy link
Contributor

@wk8 wk8 commented Sep 18, 2018

- What I did

Adds support for memory swap options in services. That includes the API
plumbing, reflected in the API's doc. Added unit tests on the new feature.

- How I did it
Adds 2 new fields to service container specs, equivalent to docker run's
--memory-swap and --memory-swappiness.

- How to verify it
Includes integration tests.

- Related issues
#34654

- Description for the changelog

Adds support for memory swap options in services.

@cpuguy83
Copy link
Member

Let's be careful about how we expose these settings.
These are very low level and platform specific, and often confusing to users.

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "wk8/memory_flags_for_swarm" git@github.com:wk8/moby.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354426360
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 22, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 22, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 23, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
// verify that the container has the swap option set
ctnr, err := client.ContainerInspect(ctx, task.Status.ContainerStatus.ContainerID)
assert.NilError(t, err)
//assert.DeepEqual(t, ctnr.HostConfig.MemorySwap, swap)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anshulpundir that's the failing test. No timing issue at all :( it's set to -1 when failing...

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Sep 24, 2018
@wk8
Copy link
Contributor Author

wk8 commented Apr 11, 2019

As per our discussion today with @thaJeztah & @cpuguy83 :

  • swap should go into the Limits struct
  • and that in turns mean that Limits and Reservations are now going to be two separate structs
    And all the changes that this entails.

kiku-jw pushed a commit to kiku-jw/moby that referenced this pull request May 16, 2019
relevant changes:

- swarmkit#2815 Extension and resource API declarations
- swarmkit#2816 Moving swap options into `ResourceRequirements` instead of `ContainerSpec`s
  - relates to moby#37872
- swarmkit#2821 allocator: use a map for network-IDs to prevent O(n2)
- swarmkit#2832 [api] Add created object to return types for extension and resource create apis
- swarmkit#2831 [controlapi] Extension api implementation
- swarmkit#2835 Resource controlapi Implemetation
- swarmkit#2802 Use custom gRPC dialer to override default proxy dialer
  - addresses moby#35395 Swarm worker cannot connect to master if proxy is configured
  - addresses moby#issues/36951 Swarm nodes cannot join as masters if http proxy is set
  - relates to swarmkit#2419 Provide custom gRPC dialer to override default proxy dialer

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
wk8 added a commit to wk8/swarmkit that referenced this pull request May 30, 2019
Hopefully the last one :)

As per moby/moby#37872 (comment)

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
@wk8
Copy link
Contributor Author

wk8 commented May 30, 2019

@thaJeztah & @cpuguy83 : before I do the changes outlined in #37872 (comment), could you please validate that https://github.com/docker/swarmkit/pull/2865/files#diff-2825f8c43cd6822a89834c265124fe46 looks good to you, and that this shape for the Limits/Resources structs should be the final one, and won't need to be changed another time? Thanks.

@wk8 wk8 force-pushed the wk8/memory_flags_for_swarm branch from 25a29c4 to ee3144f Compare June 4, 2019 23:36
@wk8 wk8 force-pushed the wk8/memory_flags_for_swarm branch 7 times, most recently from b709d06 to 05eb1d6 Compare July 29, 2019 22:35
Signed-off-by: Jean Rouge <rougej+github@gmail.com>
@wk8 wk8 force-pushed the wk8/memory_flags_for_swarm branch from 05eb1d6 to 02e3d3c Compare July 29, 2019 22:40
@david-yu
Copy link

Is this ready to merge?

@sonickenbaker
Copy link

Any update on this one?

@m-barthelemy
Copy link

Hi, is this still being worked on?

@Me1kaa
Copy link

Me1kaa commented Nov 10, 2020

Any progress here?

@mhaddadi
Copy link

mhaddadi commented Apr 9, 2021

Hi, just wondering if this PR is still in progress as it would be useful to be able to deactivate swapping in swarm mode ?
Thanks

@everyx
Copy link

everyx commented Sep 20, 2022

Any update?

@D0wn3r
Copy link

D0wn3r commented Apr 4, 2023

Still not possible to deactivate swap ?

@crowley666x
Copy link

Any update?

@rickpeters
Copy link

Anybody still out here....?

@futureecomavi
Copy link

Is anything happening with this?

@demaniak
Copy link

Has there been any further traction on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.