Skip to content

Commit 46aaeb3

Browse files
authored
Merge pull request kubernetes#85808 from ahg-g/ahg-bench
Update number of scheduler perf benchmarks to be more representative
2 parents 3e7c787 + e9c400a commit 46aaeb3

File tree

1 file changed

+16
-79
lines changed

1 file changed

+16
-79
lines changed

test/integration/scheduler_perf/scheduler_bench_test.go

Lines changed: 16 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,21 @@ var (
4444
testCSIDriver = plugins.AWSEBSDriverName
4545
// From PV controller
4646
annBindCompleted = "pv.kubernetes.io/bind-completed"
47+
48+
tests = []struct{ nodes, existingPods, minPods int }{
49+
{nodes: 500, existingPods: 500, minPods: 1000},
50+
{nodes: 5000, existingPods: 5000, minPods: 1000},
51+
}
4752
)
4853

4954
// BenchmarkScheduling benchmarks the scheduling rate when the cluster has
5055
// various quantities of nodes and scheduled pods.
5156
func BenchmarkScheduling(b *testing.B) {
52-
tests := []struct{ nodes, existingPods, minPods int }{
53-
{nodes: 100, existingPods: 0, minPods: 100},
54-
{nodes: 100, existingPods: 1000, minPods: 100},
55-
{nodes: 1000, existingPods: 0, minPods: 100},
56-
{nodes: 1000, existingPods: 1000, minPods: 100},
57-
{nodes: 5000, existingPods: 1000, minPods: 1000},
58-
}
59-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("rc1")
60-
testStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("rc2")
57+
testStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("rc1")
6158
for _, test := range tests {
6259
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
6360
b.Run(name, func(b *testing.B) {
64-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, setupStrategy, testStrategy, b)
61+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, testStrategy, b)
6562
})
6663
}
6764
}
@@ -70,14 +67,6 @@ func BenchmarkScheduling(b *testing.B) {
7067
// PodAntiAffinity rules when the cluster has various quantities of nodes and
7168
// scheduled pods.
7269
func BenchmarkSchedulingPodAntiAffinity(b *testing.B) {
73-
tests := []struct{ nodes, existingPods, minPods int }{
74-
{nodes: 500, existingPods: 250, minPods: 250},
75-
{nodes: 500, existingPods: 5000, minPods: 250},
76-
{nodes: 1000, existingPods: 1000, minPods: 500},
77-
{nodes: 5000, existingPods: 1000, minPods: 1000},
78-
}
79-
// The setup strategy creates pods with no affinity rules.
80-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
8170
testBasePod := makeBasePodWithPodAntiAffinity(
8271
map[string]string{"name": "test", "color": "green"},
8372
map[string]string{"color": "green"})
@@ -86,7 +75,7 @@ func BenchmarkSchedulingPodAntiAffinity(b *testing.B) {
8675
for _, test := range tests {
8776
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
8877
b.Run(name, func(b *testing.B) {
89-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, setupStrategy, testStrategy, b)
78+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, testStrategy, b)
9079
})
9180
}
9281
}
@@ -96,21 +85,13 @@ func BenchmarkSchedulingPodAntiAffinity(b *testing.B) {
9685
// It can be used to compare scheduler efficiency with the other benchmarks
9786
// that use volume scheduling predicates.
9887
func BenchmarkSchedulingSecrets(b *testing.B) {
99-
tests := []struct{ nodes, existingPods, minPods int }{
100-
{nodes: 500, existingPods: 250, minPods: 250},
101-
{nodes: 500, existingPods: 5000, minPods: 250},
102-
{nodes: 1000, existingPods: 1000, minPods: 500},
103-
{nodes: 5000, existingPods: 1000, minPods: 1000},
104-
}
105-
// The setup strategy creates pods with no volumes.
106-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
10788
// The test strategy creates pods with a secret.
10889
testBasePod := makeBasePodWithSecret()
10990
testStrategy := testutils.NewCustomCreatePodStrategy(testBasePod)
11091
for _, test := range tests {
11192
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
11293
b.Run(name, func(b *testing.B) {
113-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, setupStrategy, testStrategy, b)
94+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, testStrategy, b)
11495
})
11596
}
11697
}
@@ -119,23 +100,14 @@ func BenchmarkSchedulingSecrets(b *testing.B) {
119100
// in-tree volumes (used via PV/PVC). Nodes have default hardcoded attach limits
120101
// (39 for AWS EBS).
121102
func BenchmarkSchedulingInTreePVs(b *testing.B) {
122-
tests := []struct{ nodes, existingPods, minPods int }{
123-
{nodes: 500, existingPods: 250, minPods: 250},
124-
{nodes: 500, existingPods: 5000, minPods: 250},
125-
{nodes: 1000, existingPods: 1000, minPods: 500},
126-
{nodes: 5000, existingPods: 1000, minPods: 1000},
127-
}
128-
// The setup strategy creates pods with no volumes.
129-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
130-
131103
// The test strategy creates pods with AWS EBS volume used via PV.
132104
baseClaim := makeBasePersistentVolumeClaim()
133105
basePod := makeBasePod()
134106
testStrategy := testutils.NewCreatePodWithPersistentVolumeStrategy(baseClaim, awsVolumeFactory, basePod)
135107
for _, test := range tests {
136108
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
137109
b.Run(name, func(b *testing.B) {
138-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, setupStrategy, testStrategy, b)
110+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, defaultNodeStrategy, testStrategy, b)
139111
})
140112
}
141113
}
@@ -144,15 +116,6 @@ func BenchmarkSchedulingInTreePVs(b *testing.B) {
144116
// in-tree volumes (used via PV/PVC) that are migrated to CSI. CSINode instances exist
145117
// for all nodes and have proper annotation that AWS is migrated.
146118
func BenchmarkSchedulingMigratedInTreePVs(b *testing.B) {
147-
tests := []struct{ nodes, existingPods, minPods int }{
148-
{nodes: 500, existingPods: 250, minPods: 250},
149-
{nodes: 500, existingPods: 5000, minPods: 250},
150-
{nodes: 1000, existingPods: 1000, minPods: 500},
151-
{nodes: 5000, existingPods: 1000, minPods: 1000},
152-
}
153-
// The setup strategy creates pods with no volumes.
154-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
155-
156119
// The test strategy creates pods with AWS EBS volume used via PV.
157120
baseClaim := makeBasePersistentVolumeClaim()
158121
basePod := makeBasePod()
@@ -176,23 +139,13 @@ func BenchmarkSchedulingMigratedInTreePVs(b *testing.B) {
176139
b.Run(name, func(b *testing.B) {
177140
defer featuregatetesting.SetFeatureGateDuringTest(b, utilfeature.DefaultFeatureGate, features.CSIMigration, true)()
178141
defer featuregatetesting.SetFeatureGateDuringTest(b, utilfeature.DefaultFeatureGate, features.CSIMigrationAWS, true)()
179-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, setupStrategy, testStrategy, b)
142+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, testStrategy, b)
180143
})
181144
}
182145
}
183146

184147
// node.status.allocatable.
185148
func BenchmarkSchedulingCSIPVs(b *testing.B) {
186-
tests := []struct{ nodes, existingPods, minPods int }{
187-
{nodes: 500, existingPods: 250, minPods: 250},
188-
{nodes: 500, existingPods: 5000, minPods: 250},
189-
{nodes: 1000, existingPods: 1000, minPods: 500},
190-
{nodes: 5000, existingPods: 1000, minPods: 1000},
191-
}
192-
193-
// The setup strategy creates pods with no volumes.
194-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
195-
196149
// The test strategy creates pods with CSI volume via PV.
197150
baseClaim := makeBasePersistentVolumeClaim()
198151
basePod := makeBasePod()
@@ -214,7 +167,7 @@ func BenchmarkSchedulingCSIPVs(b *testing.B) {
214167
for _, test := range tests {
215168
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
216169
b.Run(name, func(b *testing.B) {
217-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, setupStrategy, testStrategy, b)
170+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, testStrategy, b)
218171
})
219172
}
220173
}
@@ -223,14 +176,6 @@ func BenchmarkSchedulingCSIPVs(b *testing.B) {
223176
// PodAffinity rules when the cluster has various quantities of nodes and
224177
// scheduled pods.
225178
func BenchmarkSchedulingPodAffinity(b *testing.B) {
226-
tests := []struct{ nodes, existingPods, minPods int }{
227-
{nodes: 500, existingPods: 250, minPods: 250},
228-
{nodes: 500, existingPods: 5000, minPods: 250},
229-
{nodes: 1000, existingPods: 1000, minPods: 500},
230-
{nodes: 5000, existingPods: 1000, minPods: 1000},
231-
}
232-
// The setup strategy creates pods with no affinity rules.
233-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
234179
testBasePod := makeBasePodWithPodAffinity(
235180
map[string]string{"foo": ""},
236181
map[string]string{"foo": ""},
@@ -241,7 +186,7 @@ func BenchmarkSchedulingPodAffinity(b *testing.B) {
241186
for _, test := range tests {
242187
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
243188
b.Run(name, func(b *testing.B) {
244-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, setupStrategy, testStrategy, b)
189+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, testStrategy, b)
245190
})
246191
}
247192
}
@@ -250,22 +195,14 @@ func BenchmarkSchedulingPodAffinity(b *testing.B) {
250195
// NodeAffinity rules when the cluster has various quantities of nodes and
251196
// scheduled pods.
252197
func BenchmarkSchedulingNodeAffinity(b *testing.B) {
253-
tests := []struct{ nodes, existingPods, minPods int }{
254-
{nodes: 500, existingPods: 250, minPods: 250},
255-
{nodes: 500, existingPods: 5000, minPods: 250},
256-
{nodes: 1000, existingPods: 1000, minPods: 500},
257-
{nodes: 5000, existingPods: 1000, minPods: 1000},
258-
}
259-
// The setup strategy creates pods with no affinity rules.
260-
setupStrategy := testutils.NewSimpleWithControllerCreatePodStrategy("setup")
261198
testBasePod := makeBasePodWithNodeAffinity(v1.LabelZoneFailureDomain, []string{"zone1", "zone2"})
262199
// The test strategy creates pods with node-affinity for each other.
263200
testStrategy := testutils.NewCustomCreatePodStrategy(testBasePod)
264201
nodeStrategy := testutils.NewLabelNodePrepareStrategy(v1.LabelZoneFailureDomain, "zone1")
265202
for _, test := range tests {
266203
name := fmt.Sprintf("%vNodes/%vPods", test.nodes, test.existingPods)
267204
b.Run(name, func(b *testing.B) {
268-
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, setupStrategy, testStrategy, b)
205+
benchmarkScheduling(test.nodes, test.existingPods, test.minPods, nodeStrategy, testStrategy, b)
269206
})
270207
}
271208
}
@@ -355,7 +292,7 @@ func makeBasePodWithNodeAffinity(key string, vals []string) *v1.Pod {
355292
// least minPods pods during the benchmark.
356293
func benchmarkScheduling(numNodes, numExistingPods, minPods int,
357294
nodeStrategy testutils.PrepareNodeStrategy,
358-
setupPodStrategy, testPodStrategy testutils.TestPodCreateStrategy,
295+
testPodStrategy testutils.TestPodCreateStrategy,
359296
b *testing.B) {
360297
if b.N < minPods {
361298
b.N = minPods
@@ -374,7 +311,7 @@ func benchmarkScheduling(numNodes, numExistingPods, minPods int,
374311
defer nodePreparer.CleanupNodes()
375312

376313
config := testutils.NewTestPodCreatorConfig()
377-
config.AddStrategy("sched-test", numExistingPods, setupPodStrategy)
314+
config.AddStrategy("sched-setup", numExistingPods, testPodStrategy)
378315
podCreator := testutils.NewTestPodCreator(clientset, config)
379316
podCreator.CreatePods()
380317

0 commit comments

Comments
 (0)