• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Sep-2021-

config/H15-Sep-2021-1,1431,096

.gitignoreH A D15-Sep-202131 21

OWNERSH A D15-Sep-2021119 75

README.mdH A D15-Sep-20214.2 KiB9167

main_test.goH A D15-Sep-2021743 3010

scheduler_perf_legacy_test.goH A D15-Sep-202122.3 KiB627499

scheduler_perf_test.goH A D15-Sep-202133.9 KiB1,058824

scheduler_perf_types.goH A D15-Sep-20211.2 KiB3210

scheduler_test.goH A D15-Sep-20219.7 KiB301214

util.goH A D15-Sep-20219.9 KiB324241

README.md

1Scheduler Performance Test
2======
3
4Motivation
5------
6We already have a performance testing system -- Kubemark. However, Kubemark requires setting up and bootstrapping a whole cluster, which takes a lot of time.
7
8We want to have a standard way to reproduce scheduling latency metrics result and benchmark scheduler as simple and fast as possible. We have the following goals:
9
10- Save time on testing
11  - The test and benchmark can be run in a single box.
12    We only set up components necessary to scheduling without booting up a cluster.
13- Profiling runtime metrics to find out bottleneck
14  - Write scheduler integration test but focus on performance measurement.
15    Take advantage of go profiling tools and collect fine-grained metrics,
16    like cpu-profiling, memory-profiling and block-profiling.
17- Reproduce test result easily
18  - We want to have a known place to do the performance related test for scheduler.
19    Developers should just run one script to collect all the information they need.
20
21Currently the test suite has the following:
22
23- density test (by adding a new Go test)
24  - schedule 30k pods on 1000 (fake) nodes and 3k pods on 100 (fake) nodes
25  - print out scheduling rate every second
26  - let you learn the rate changes vs number of scheduled pods
27- benchmark
28  - make use of `go test -bench` and report nanosecond/op.
29  - schedule b.N pods when the cluster has N nodes and P scheduled pods. Since it takes relatively long time to finish one round, b.N is small: 10 - 100.
30
31
32How To Run
33------
34
35## Density tests
36
37```shell
38# In Kubernetes root path
39make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=true -logtostderr=true -run=." KUBE_TIMEOUT="--timeout=60m" SHORT="--short=false"
40```
41
42## Benchmark tests
43
44```shell
45# In Kubernetes root path
46make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling"
47```
48
49The benchmark suite runs all the tests specified under config/performance-config.yaml.
50
51Once the benchmark is finished, JSON file with metrics is available in the current directory (test/integration/scheduler_perf). Look for `BenchmarkPerfScheduling_YYYY-MM-DDTHH:MM:SSZ.json`.
52You can use `-data-items-dir` to generate the metrics file elsewhere.
53
54In case you want to run a specific test in the suite, you can specify the test through `-bench` flag:
55
56Also, bench time is explicitly set to 1ns (`-benchtime=1ns` flag) so each test is run only once.
57Otherwise, the golang benchmark framework will try to run a test more than once in case it ran for less than 1s.
58
59```shell
60# In Kubernetes root path
61make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule"
62```
63
64To produce a cpu profile:
65
66```shell
67# In Kubernetes root path
68make test-integration WHAT=./test/integration/scheduler_perf KUBE_TIMEOUT="-timeout=3600s" KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out"
69```
70
71### How to configure benchmark tests
72
73Configuration file located under `config/performance-config.yaml` contains a list of templates.
74Each template allows to set:
75- node manifest
76- manifests for initial and testing pod
77- number of nodes, number of initial and testing pods
78- templates for PVs and PVCs
79- feature gates
80
81See `op` data type implementation in [scheduler_perf_test.go](scheduler_perf_test.go)
82for available operations to build `WorkloadTemplate`.
83
84Initial pods create a state of a cluster before the scheduler performance measurement can begin.
85Testing pods are then subject to performance measurement.
86
87The configuration file under `config/performance-config.yaml` contains a default list of templates to cover
88various scenarios. In case you want to add your own, you can extend the list with new templates.
89It's also possible to extend `op` data type, respectively its underlying data types
90to extend configuration of possible test cases.
91