-
Notifications
You must be signed in to change notification settings - Fork 290
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
[FLOC-4530] Pass the swappiness configuration value to the Docker API #2946
base: master
Are you sure you want to change the base?
[FLOC-4530] Pass the swappiness configuration value to the Docker API #2946
Conversation
…equires us to use a newer docker API version and some corresponding changes to the cpu shares and memory discovery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good, didnt review in a lot of detail.
Docker reference memory-swappiness is inherited from the parent if not set, i didnt see a default setting so i assume evaluating None
does this somehow?
By default, if you are not using --memory-swappiness, memory swappiness value will be inherited from the parent.
- https://docs.docker.com/engine/reference/run/#/swappiness-constraint
Also, this only matters for swisscom using the container agent right? Once they switch over to kibernetes they can set swappiness via POD specs
cpu_shares = None if cpu_shares == 0 else cpu_shares | ||
mem_limit = data[u"Config"][u"Memory"] | ||
mem_limit = data[u"HostConfig"][u"Memory"] | ||
mem_limit = None if mem_limit == 0 else mem_limit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do a similar thing for swappiness here?
application_name = u'site-example.com' | ||
application = Application( | ||
name=application_name, | ||
image=DockerImage(repository=u'clusterhq/postgresql', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why dont we use a smaller image here? Any reason we are using postgresql just to test the swappiness? Could mean longer pulls for new test nodes.
In #2946 (comment) @wallnerryan wrote:
I've been thinking about it.
Which might very well be a problem; ie unscheduled restart and all containers restarting at once may very well overload the server. I guess I should go back to the drawing board and make the default swappiness None 😢 |
The intention was for default to be My vote would not to over complicate it and just set the default to 0, but make it configurable if they want/need it. Swappiness should not be set to -1, but rather 0 be default and placed into the HostConfig for the DockerClient. That way, in thoery, the restart issue should only happen if they containers swappiness is changed out of band, which im not sure if possible, but rather any changes would need to happen in the deployment yaml. I think strongly forcing |
I've suggested (as a work around) changing the memory.swappiness value in the parent dockerd namespace.
|
Fixes: https://clusterhq.atlassian.net/browse/FLOC-4530
In #2818 we added swappiness parameter to the container API but the implementation wasn't complete.
The swappiness was not passed through to the Docker API.
And the swappiness was not inspected by the ApplicationDeployer.
This branch adds that missing piece and a functional test that demonstrates that swappiness is set and discovered.
I haven't added an acceptance test for this because we generally trust that Docker will do the right thing if it's passed the appropriate flags.
You can see the swappiness configuration of a container by doing something like:
Or inspecting the /sys/fs/cgroups on the host
I haven't found a good way to see whether the dockerized process does get swapped out with values of 0 and >0.