// logAndVerifyLatency verifies that whether pod creation latency satisfies the limit. func logAndVerifyLatency(batchLag time.Duration, e2eLags []framework.PodLatencyData, podStartupLimits framework.LatencyMetric, podBatchStartupLimit time.Duration, testName string, isVerify bool) { framework.PrintLatencies(e2eLags, "worst client e2e total latencies") // TODO(coufon): do not trust 'kubelet' metrics since they are not reset! latencyMetrics, _ := getPodStartLatency(kubeletAddr) framework.Logf("Kubelet Prometheus metrics (not reset):\n%s", framework.PrettyPrintJSON(latencyMetrics)) podCreateLatency := framework.PodStartupLatency{Latency: framework.ExtractLatencyMetrics(e2eLags)} // log latency perf data framework.PrintPerfData(getLatencyPerfData(podCreateLatency.Latency, testName)) if isVerify { // check whether e2e pod startup time is acceptable. framework.ExpectNoError(verifyPodStartupLatency(podStartupLimits, podCreateLatency.Latency)) // check bactch pod creation latency if podBatchStartupLimit > 0 { Expect(batchLag <= podBatchStartupLimit).To(Equal(true), "Batch creation startup time %v exceed limit %v", batchLag, podBatchStartupLimit) } } }
// verifyLatency verifies that whether pod creation latency satisfies the limit. func verifyLatency(batchLag time.Duration, e2eLags []framework.PodLatencyData, testArg densityTest) { framework.PrintLatencies(e2eLags, "worst client e2e total latencies") // Zhou: do not trust `kubelet' metrics since they are not reset! latencyMetrics, _ := getPodStartLatency(kubeletAddr) framework.Logf("Kubelet Prometheus metrics (not reset):\n%s", framework.PrettyPrintJSON(latencyMetrics)) // check whether e2e pod startup time is acceptable. podCreateLatency := framework.PodStartupLatency{Latency: framework.ExtractLatencyMetrics(e2eLags)} framework.Logf("Pod create latency: %s", framework.PrettyPrintJSON(podCreateLatency)) framework.ExpectNoError(verifyPodStartupLatency(testArg.podStartupLimits, podCreateLatency.Latency)) // check bactch pod creation latency if testArg.podBatchStartupLimit > 0 { Expect(batchLag <= testArg.podBatchStartupLimit).To(Equal(true), "Batch creation startup time %v exceed limit %v", batchLag, testArg.podBatchStartupLimit) } // calculate and log throughput throughputBatch := float64(testArg.podsNr) / batchLag.Minutes() framework.Logf("Batch creation throughput is %.1f pods/min", throughputBatch) throughputSequential := 1.0 / e2eLags[len(e2eLags)-1].Latency.Minutes() framework.Logf("Sequential creation throughput is %.1f pods/min", throughputSequential) }
Expect(ok).To(Equal(true)) scheduleLag = append(scheduleLag, framework.PodLatencyData{Name: name, Node: node, Latency: sched.Time.Sub(create.Time)}) startupLag = append(startupLag, framework.PodLatencyData{Name: name, Node: node, Latency: run.Time.Sub(sched.Time)}) watchLag = append(watchLag, framework.PodLatencyData{Name: name, Node: node, Latency: watch.Time.Sub(run.Time)}) schedToWatchLag = append(schedToWatchLag, framework.PodLatencyData{Name: name, Node: node, Latency: watch.Time.Sub(sched.Time)}) e2eLag = append(e2eLag, framework.PodLatencyData{Name: name, Node: node, Latency: watch.Time.Sub(create.Time)}) } sort.Sort(framework.LatencySlice(scheduleLag)) sort.Sort(framework.LatencySlice(startupLag)) sort.Sort(framework.LatencySlice(watchLag)) sort.Sort(framework.LatencySlice(schedToWatchLag)) sort.Sort(framework.LatencySlice(e2eLag)) framework.PrintLatencies(scheduleLag, "worst schedule latencies") framework.PrintLatencies(startupLag, "worst run-after-schedule latencies") framework.PrintLatencies(watchLag, "worst watch latencies") framework.PrintLatencies(schedToWatchLag, "worst scheduled-to-end total latencies") framework.PrintLatencies(e2eLag, "worst e2e total latencies") // Test whether e2e pod startup time is acceptable. podStartupLatency := framework.PodStartupLatency{Latency: framework.ExtractLatencyMetrics(e2eLag)} framework.ExpectNoError(framework.VerifyPodStartupLatency(podStartupLatency)) framework.LogSuspiciousLatency(startupLag, e2eLag, nodeCount, c) } cleanupDensityTest(dConfig) By("Removing additional replication controllers if any")