mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
scheduler_perf: use -benchtime=1x in the test examples
Update scheduler performance test examples to use `-benchtime=1x` instead of `-benchtime=1ns` for explicitly running each benchmark exactly once. This makes the intent clearer and aligns the examples with recommended Go benchmark usage. Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
This commit is contained in:
@@ -33,7 +33,7 @@ Currently the test suite has the following:
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" FULL_LOG=y ARTIFACTS=/tmp SHORT=-short=false KUBE_TEST_ARGS='-run=^$ -benchtime=1ns -bench=BenchmarkPerfScheduling'
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" FULL_LOG=y ARTIFACTS=/tmp SHORT=-short=false KUBE_TEST_ARGS='-run=^$ -benchtime=1x -bench=BenchmarkPerfScheduling'
|
||||
```
|
||||
|
||||
The output can used for [`benchstat`](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat)
|
||||
@@ -51,7 +51,7 @@ a comma-separated list of label names. Each label may have a `+` or `-` as prefi
|
||||
be set. For example, this runs all performance benchmarks except those that are labeled
|
||||
as "integration-test":
|
||||
```shell
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" SHORT=-short=false ARTIFACTS=/tmp FULL_LOG=y KUBE_TEST_ARGS='-run=^$ -benchtime=1ns -bench=BenchmarkPerfScheduling -perf-scheduling-label-filter=performance,-integration-test'
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" SHORT=-short=false ARTIFACTS=/tmp FULL_LOG=y KUBE_TEST_ARGS='-run=^$ -benchtime=1x -bench=BenchmarkPerfScheduling -perf-scheduling-label-filter=performance,-integration-test'
|
||||
```
|
||||
|
||||
Once the benchmark is finished, JSON files with metrics are available in the subdirectories (`test/integration/scheduler_perf/config/<topic>`).
|
||||
@@ -60,12 +60,12 @@ You can use `-data-items-dir` to generate the metrics files elsewhere.
|
||||
|
||||
In case you want to run a specific test in the suite, you can specify the test through `-bench` flag:
|
||||
|
||||
Also, bench time is explicitly set to 1ns (`-benchtime=1ns` flag) so each test is run only once.
|
||||
Also, bench time is explicitly set to run each test only once (`-benchtime=1x` flag).
|
||||
Otherwise, the golang benchmark framework will try to run a test more than once in case it ran for less than 1s.
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" SHORT=-short=false ARTIFACTS=/tmp FULL_LOG=y KUBE_TEST_ARGS='-run=^$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule'
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/... KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" SHORT=-short=false ARTIFACTS=/tmp FULL_LOG=y KUBE_TEST_ARGS='-run=^$ -benchtime=1x -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule'
|
||||
```
|
||||
|
||||
To run a test with profiler you need to target a specific package directory as `go test` does not support profiling across multiple packages.
|
||||
@@ -74,7 +74,7 @@ To produce a cpu profile:
|
||||
|
||||
```shell
|
||||
# In Kubernetes root path
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/misc KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" FULL_LOG=y ARTIFACTS=/tmp SHORT=-short=false KUBE_TEST_ARGS='-run=^$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out'
|
||||
make test-integration WHAT=./test/integration/scheduler_perf/misc KUBE_CACHE_MUTATION_DETECTOR=false KUBE_TIMEOUT=-timeout=1h ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" FULL_LOG=y ARTIFACTS=/tmp SHORT=-short=false KUBE_TEST_ARGS='-run=^$ -benchtime=1x -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out'
|
||||
```
|
||||
|
||||
Here some explanations for those parameters:
|
||||
|
||||
Reference in New Issue
Block a user