Commit 2632a6a6 authored by Maciej Borsz's avatar Maciej Borsz

Scalability tests: Increase sample size for pod startup latency measurement.

parent 4bec356e
...@@ -56,6 +56,7 @@ const ( ...@@ -56,6 +56,7 @@ const (
MinSaturationThreshold = 2 * time.Minute MinSaturationThreshold = 2 * time.Minute
MinPodsPerSecondThroughput = 8 MinPodsPerSecondThroughput = 8
DensityPollInterval = 10 * time.Second DensityPollInterval = 10 * time.Second
MinPodStartupMeasurements = 500
) )
// Maximum container failures this test tolerates before failing. // Maximum container failures this test tolerates before failing.
...@@ -696,7 +697,10 @@ var _ = SIGDescribe("Density", func() { ...@@ -696,7 +697,10 @@ var _ = SIGDescribe("Density", func() {
} }
e2eStartupTime = runDensityTest(dConfig, testPhaseDurations, &scheduleThroughputs) e2eStartupTime = runDensityTest(dConfig, testPhaseDurations, &scheduleThroughputs)
if itArg.runLatencyTest { if itArg.runLatencyTest {
By("Scheduling additional Pods to measure startup latencies") // Pick latencyPodsIterations so that:
// latencyPodsIterations * nodeCount >= MinPodStartupMeasurements.
latencyPodsIterations := (MinPodStartupMeasurements + nodeCount - 1) / nodeCount
By(fmt.Sprintf("Scheduling additional %d Pods to measure startup latencies", latencyPodsIterations*nodeCount))
createTimes := make(map[string]metav1.Time, 0) createTimes := make(map[string]metav1.Time, 0)
nodeNames := make(map[string]string, 0) nodeNames := make(map[string]string, 0)
...@@ -775,58 +779,76 @@ var _ = SIGDescribe("Density", func() { ...@@ -775,58 +779,76 @@ var _ = SIGDescribe("Density", func() {
go controller.Run(stopCh) go controller.Run(stopCh)
} }
for latencyPodsIteration := 0; latencyPodsIteration < latencyPodsIterations; latencyPodsIteration++ {
// Create some additional pods with throughput ~5 pods/sec. podIndexOffset := latencyPodsIteration * nodeCount
latencyPodStartupPhase := testPhaseDurations.StartPhase(800, "latency pods creation") framework.Logf("Creating %d latency pods in range [%d, %d]", nodeCount, podIndexOffset+1, podIndexOffset+nodeCount)
defer latencyPodStartupPhase.End()
var wg sync.WaitGroup watchTimesLen := len(watchTimes)
wg.Add(nodeCount)
// Explicitly set requests here. // Create some additional pods with throughput ~5 pods/sec.
// Thanks to it we trigger increasing priority function by scheduling latencyPodStartupPhase := testPhaseDurations.StartPhase(800+latencyPodsIteration*10, "latency pods creation")
// a pod to a node, which in turn will result in spreading latency pods defer latencyPodStartupPhase.End()
// more evenly between nodes. var wg sync.WaitGroup
cpuRequest := *resource.NewMilliQuantity(nodeCpuCapacity/5, resource.DecimalSI) wg.Add(nodeCount)
memRequest := *resource.NewQuantity(nodeMemCapacity/5, resource.DecimalSI) // Explicitly set requests here.
if podsPerNode > 30 { // Thanks to it we trigger increasing priority function by scheduling
// This is to make them schedulable on high-density tests // a pod to a node, which in turn will result in spreading latency pods
// (e.g. 100 pods/node kubemark). // more evenly between nodes.
cpuRequest = *resource.NewMilliQuantity(0, resource.DecimalSI) cpuRequest := *resource.NewMilliQuantity(nodeCpuCapacity/5, resource.DecimalSI)
memRequest = *resource.NewQuantity(0, resource.DecimalSI) memRequest := *resource.NewQuantity(nodeMemCapacity/5, resource.DecimalSI)
} if podsPerNode > 30 {
rcNameToNsMap := map[string]string{} // This is to make them schedulable on high-density tests
for i := 1; i <= nodeCount; i++ { // (e.g. 100 pods/node kubemark).
name := additionalPodsPrefix + "-" + strconv.Itoa(i) cpuRequest = *resource.NewMilliQuantity(0, resource.DecimalSI)
nsName := namespaces[i%len(namespaces)].Name memRequest = *resource.NewQuantity(0, resource.DecimalSI)
rcNameToNsMap[name] = nsName
go createRunningPodFromRC(&wg, c, name, nsName, imageutils.GetPauseImageName(), additionalPodsPrefix, cpuRequest, memRequest)
time.Sleep(200 * time.Millisecond)
}
wg.Wait()
latencyPodStartupPhase.End()
latencyMeasurementPhase := testPhaseDurations.StartPhase(810, "pod startup latencies measurement")
defer latencyMeasurementPhase.End()
By("Waiting for all Pods begin observed by the watch...")
waitTimeout := 10 * time.Minute
for start := time.Now(); len(watchTimes) < nodeCount; time.Sleep(10 * time.Second) {
if time.Since(start) < waitTimeout {
framework.Failf("Timeout reached waiting for all Pods being observed by the watch.")
} }
} rcNameToNsMap := map[string]string{}
close(stopCh) for i := 1; i <= nodeCount; i++ {
name := additionalPodsPrefix + "-" + strconv.Itoa(podIndexOffset+i)
nodeToLatencyPods := make(map[string]int) nsName := namespaces[i%len(namespaces)].Name
for i := range latencyPodStores { rcNameToNsMap[name] = nsName
for _, item := range latencyPodStores[i].List() { go createRunningPodFromRC(&wg, c, name, nsName, imageutils.GetPauseImageName(), additionalPodsPrefix, cpuRequest, memRequest)
pod := item.(*v1.Pod) time.Sleep(200 * time.Millisecond)
nodeToLatencyPods[pod.Spec.NodeName]++ }
wg.Wait()
latencyPodStartupPhase.End()
latencyMeasurementPhase := testPhaseDurations.StartPhase(801+latencyPodsIteration*10, "pod startup latencies measurement")
defer latencyMeasurementPhase.End()
By("Waiting for all Pods begin observed by the watch...")
waitTimeout := 10 * time.Minute
for start := time.Now(); len(watchTimes) < watchTimesLen+nodeCount; time.Sleep(10 * time.Second) {
if time.Since(start) < waitTimeout {
framework.Failf("Timeout reached waiting for all Pods being observed by the watch.")
}
} }
for node, count := range nodeToLatencyPods {
if count > 1 { nodeToLatencyPods := make(map[string]int)
framework.Logf("%d latency pods scheduled on %s", count, node) for i := range latencyPodStores {
for _, item := range latencyPodStores[i].List() {
pod := item.(*v1.Pod)
nodeToLatencyPods[pod.Spec.NodeName]++
}
for node, count := range nodeToLatencyPods {
if count > 1 {
framework.Logf("%d latency pods scheduled on %s", count, node)
}
} }
} }
latencyMeasurementPhase.End()
By("Removing additional replication controllers")
podDeletionPhase := testPhaseDurations.StartPhase(802+latencyPodsIteration*10, "latency pods deletion")
defer podDeletionPhase.End()
deleteRC := func(i int) {
defer GinkgoRecover()
name := additionalPodsPrefix + "-" + strconv.Itoa(podIndexOffset+i+1)
framework.ExpectNoError(framework.DeleteRCAndWaitForGC(c, rcNameToNsMap[name], name))
}
workqueue.Parallelize(25, nodeCount, deleteRC)
podDeletionPhase.End()
} }
close(stopCh)
for i := 0; i < len(namespaces); i++ { for i := 0; i < len(namespaces); i++ {
nsName := namespaces[i].Name nsName := namespaces[i].Name
...@@ -914,18 +936,6 @@ var _ = SIGDescribe("Density", func() { ...@@ -914,18 +936,6 @@ var _ = SIGDescribe("Density", func() {
framework.ExpectNoError(framework.VerifyLatencyWithinThreshold(podStartupLatencyThreshold, podStartupLatency.E2ELatency, "pod startup")) framework.ExpectNoError(framework.VerifyLatencyWithinThreshold(podStartupLatencyThreshold, podStartupLatency.E2ELatency, "pod startup"))
framework.LogSuspiciousLatency(startupLag, e2eLag, nodeCount, c) framework.LogSuspiciousLatency(startupLag, e2eLag, nodeCount, c)
latencyMeasurementPhase.End()
By("Removing additional replication controllers")
podDeletionPhase := testPhaseDurations.StartPhase(820, "latency pods deletion")
defer podDeletionPhase.End()
deleteRC := func(i int) {
defer GinkgoRecover()
name := additionalPodsPrefix + "-" + strconv.Itoa(i+1)
framework.ExpectNoError(framework.DeleteRCAndWaitForGC(c, rcNameToNsMap[name], name))
}
workqueue.Parallelize(25, nodeCount, deleteRC)
podDeletionPhase.End()
} }
cleanupDensityTest(dConfig, testPhaseDurations) cleanupDensityTest(dConfig, testPhaseDurations)
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment