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

e2e: set RSS memory usage limit for kubelet/docker #21785

Merged
merged 2 commits into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 24 additions & 13 deletions test/e2e/kubelet_perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const (

type resourceTest struct {
podsPerNode int
limits containersCPUSummary
cpuLimits containersCPUSummary
memLimits resourceUsagePerContainer
}

func logPodsOnNodes(c *client.Client, nodeNames []string) {
Expand All @@ -55,7 +56,8 @@ func logPodsOnNodes(c *client.Client, nodeNames []string) {
}
}

func runResourceTrackingTest(framework *Framework, podsPerNode int, nodeNames sets.String, rm *resourceMonitor, expected map[string]map[float64]float64) {
func runResourceTrackingTest(framework *Framework, podsPerNode int, nodeNames sets.String, rm *resourceMonitor,
expectedCPU map[string]map[float64]float64, expectedMemory resourceUsagePerContainer) {
numNodes := nodeNames.Len()
totalPods := podsPerNode * numNodes
By(fmt.Sprintf("Creating a RC of %d pods and wait until all pods of this RC are running", totalPods))
Expand Down Expand Up @@ -94,19 +96,14 @@ func runResourceTrackingTest(framework *Framework, podsPerNode int, nodeNames se

By("Reporting overall resource usage")
logPodsOnNodes(framework.Client, nodeNames.List())
rm.LogLatest()
usageSummary, err := rm.GetLatest()
Expect(err).NotTo(HaveOccurred())
Logf("%s", rm.FormatResourceUsage(usageSummary))
// TODO(yujuhong): Set realistic values after gathering enough data.
verifyMemoryLimits(resourceUsagePerContainer{
"/kubelet": &containerResourceUsage{MemoryRSSInBytes: 500 * 1024 * 1024},
"/docker-daemon": &containerResourceUsage{MemoryRSSInBytes: 500 * 1024 * 1024},
}, usageSummary)
verifyMemoryLimits(expectedMemory, usageSummary)

cpuSummary := rm.GetCPUSummary()
Logf("%s", rm.FormatCPUSummary(cpuSummary))
verifyCPULimits(expected, cpuSummary)
verifyCPULimits(expectedCPU, cpuSummary)

By("Deleting the RC")
DeleteRC(framework.Client, framework.Namespace.Name, rcName)
Expand Down Expand Up @@ -208,16 +205,30 @@ var _ = Describe("Kubelet [Serial] [Slow]", func() {
// noise.
rTests := []resourceTest{
{podsPerNode: 0,
limits: containersCPUSummary{
cpuLimits: containersCPUSummary{
"/kubelet": {0.50: 0.06, 0.95: 0.08},
"/docker-daemon": {0.50: 0.05, 0.95: 0.06},
},
// We set the memory limits generously because the distribution
// of the addon pods affect the memory usage on each node.
memLimits: resourceUsagePerContainer{
"/kubelet": &containerResourceUsage{MemoryRSSInBytes: 70 * 1024 * 1024},
"/docker-daemon": &containerResourceUsage{MemoryRSSInBytes: 85 * 1024 * 1024},
},
},
// TODO(yujuhong): change this test to ~100 pods per node after
// --max-pods have been changed.
{podsPerNode: 35,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update the test to run 100 pods? Since the limit is lesser than that as of now, we can do it in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I plan to do it in another PR, after --max-pods is bumped.

limits: containersCPUSummary{
cpuLimits: containersCPUSummary{
"/kubelet": {0.50: 0.12, 0.95: 0.14},
"/docker-daemon": {0.50: 0.06, 0.95: 0.08},
},
// We set the memory limits generously because the distribution
// of the addon pods affect the memory usage on each node.
memLimits: resourceUsagePerContainer{
"/kubelet": &containerResourceUsage{MemoryRSSInBytes: 75 * 1024 * 1024},
"/docker-daemon": &containerResourceUsage{MemoryRSSInBytes: 100 * 1024 * 1024},
},
},
}
for _, testArg := range rTests {
Expand All @@ -226,7 +237,7 @@ var _ = Describe("Kubelet [Serial] [Slow]", func() {
name := fmt.Sprintf(
"for %d pods per node over %v", podsPerNode, monitoringTime)
It(name, func() {
runResourceTrackingTest(framework, podsPerNode, nodeNames, rm, itArg.limits)
runResourceTrackingTest(framework, podsPerNode, nodeNames, rm, itArg.cpuLimits, itArg.memLimits)
})
}
})
Expand All @@ -237,7 +248,7 @@ var _ = Describe("Kubelet [Serial] [Slow]", func() {
name := fmt.Sprintf(
"for %d pods per node over %v", podsPerNode, monitoringTime)
It(name, func() {
runResourceTrackingTest(framework, podsPerNode, nodeNames, rm, nil)
runResourceTrackingTest(framework, podsPerNode, nodeNames, rm, nil, nil)
})
}
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/kubelet_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func (r *resourceMonitor) LogLatest() {
if err != nil {
Logf("%v", err)
}
r.FormatResourceUsage(summary)
Logf(r.FormatResourceUsage(summary))
}

func (r *resourceMonitor) FormatResourceUsage(s resourceUsagePerNode) string {
Expand Down