diff --git a/Makefile b/Makefile index d86741d90a4..14f28d517ae 100644 --- a/Makefile +++ b/Makefile @@ -17,11 +17,46 @@ else @echo "benchmark tool already installed..." endif +# Benchmark make targets extend scripts/benchmark_test.sh (see #16467). +# Override defaults with ARGS, e.g.: +# make bench-put ARGS='--total=100000 --clients=100' +# make bench-range ARGS='--total=50000 --consistency=s' + .PHONY: bench-put bench-put: build install-benchmark @echo "Running benchmark: put $(ARGS)" ./scripts/benchmark_test.sh put $(ARGS) +.PHONY: bench-range +bench-range: build install-benchmark + @echo "Running benchmark: range $(ARGS)" + ./scripts/benchmark_test.sh range foo $(ARGS) + +.PHONY: bench-txn-put +bench-txn-put: build install-benchmark + @echo "Running benchmark: txn-put $(ARGS)" + ./scripts/benchmark_test.sh txn-put $(ARGS) + +.PHONY: bench-stm +bench-stm: build install-benchmark + @echo "Running benchmark: stm $(ARGS)" + ./scripts/benchmark_test.sh stm $(ARGS) + +.PHONY: bench-lease-keepalive +bench-lease-keepalive: build install-benchmark + @echo "Running benchmark: lease-keepalive $(ARGS)" + ./scripts/benchmark_test.sh lease-keepalive $(ARGS) + +.PHONY: bench-watch +bench-watch: build install-benchmark + @echo "Running benchmark: watch $(ARGS)" + ./scripts/benchmark_test.sh watch $(ARGS) + +.PHONY: bench-watch-latency +bench-watch-latency: build install-benchmark + @echo "Running benchmark: watch-latency $(ARGS)" + ./scripts/benchmark_test.sh watch-latency $(ARGS) + PLATFORMS=linux-amd64 linux-386 linux-arm linux-arm64 linux-ppc64le linux-s390x darwin-amd64 darwin-arm64 windows-amd64 windows-arm64 .PHONY: build-all diff --git a/tools/benchmark/README.md b/tools/benchmark/README.md index c3dbe919ee8..22837a0c10a 100644 --- a/tools/benchmark/README.md +++ b/tools/benchmark/README.md @@ -22,6 +22,38 @@ Alternatively, instead of installing the tool, you can use it by simply running $ go run ./tools/benchmark ``` +## Running via make (local etcd) + +From the repository root, use the `bench-*` make targets. Each target builds etcd, +installs the benchmark tool if needed, starts a temporary local etcd process, runs +the named workload with `--report-perfdash`, then tears the server down +(see `scripts/benchmark_test.sh` and +[#16467](https://github.com/etcd-io/etcd/issues/16467)). + +```bash +make bench-put +make bench-range +make bench-txn-put +make bench-stm +make bench-lease-keepalive +make bench-watch +make bench-watch-latency +``` + +Pass extra flags through `ARGS`: + +```bash +make bench-put ARGS='--total=100000 --clients=100 --conns=10' +make bench-range ARGS='--total=50000 --consistency=s --limit=100' +``` + +`bench-range` uses a default key of `foo`. For custom range bounds, call the +script directly: + +```bash +./scripts/benchmark_test.sh range mykey myend --total=10000 +``` + ## Usage The following command should output the usage per the latest development.