mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-07 06:22:03 +00:00
Add the memory swappiness tuning option to docker.
Memory swappiness option takes 0-100, and helps to tune swappiness behavior per container. For example, When a lower value of swappiness is chosen the container will see minimum major faults. When no value is specified for memory-swappiness in docker UI, it is inherited from parent cgroup. (generally 60 unless it is changed). Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
This commit is contained in:
@@ -61,6 +61,27 @@ func (s *DockerSuite) TestRunWithoutMemoryswapLimit(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "--memory-swappiness", "0", "busybox", "true")
|
||||
out, _, err := runCommandWithOutput(runCmd)
|
||||
if err != nil {
|
||||
c.Fatalf("failed to run container, output: %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "--memory-swappiness", "101", "busybox", "true")
|
||||
out, _, err := runCommandWithOutput(runCmd)
|
||||
if err == nil {
|
||||
c.Fatalf("failed. test was able to set invalid value, output: %q", out)
|
||||
}
|
||||
runCmd = exec.Command(dockerBinary, "run", "--memory-swappiness", "-1", "busybox", "true")
|
||||
out, _, err = runCommandWithOutput(runCmd)
|
||||
if err == nil {
|
||||
c.Fatalf("failed. test was able to set invalid value, output: %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
// "test" should be printed
|
||||
func (s *DockerSuite) TestRunEchoStdoutWitCPULimit(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "-c", "1000", "busybox", "echo", "test")
|
||||
|
||||
Reference in New Issue
Block a user