grpc/tools/run_tests/performance
Vijay Pai 4b07aab513 Support multiple threads per cq sharing, add tests 2017-05-23 09:20:56 -07:00
..
README.md add notes to build and run workers in different languages 2017-03-29 21:37:04 -07:00
__init__.py Add copyright, tweak name 2016-04-04 13:49:29 -07:00
bq_upload_result.py Modify shebang on python scripts 2017-03-12 19:53:12 +01:00
build_performance.sh Removed another couple of uses of '--iomgr_platform=uv' 2017-04-25 10:20:37 -07:00
build_performance_go.sh integrate Go qps worker 2016-05-11 09:37:12 -07:00
kill_workers.sh switch C# benchmark to coreclr 2016-10-14 16:44:49 +02:00
process_local_perf_flamegraphs.sh add a "perf" option to benchmarks script, generate profile text reports and flamegraphs 2016-12-08 16:03:19 -08:00
process_remote_perf_flamegraphs.sh add a "perf" option to benchmarks script, generate profile text reports and flamegraphs 2016-12-08 16:03:19 -08:00
remote_host_build.sh Remove unnecessary -2016 from copyrights 2016-04-05 08:36:49 -07:00
remote_host_prepare.sh enable running windows perf tests 2016-11-16 18:46:18 +01:00
run_netperf.sh explicitly specify request and response size for netperf 2016-05-10 14:33:21 -07:00
run_qps_driver.sh result uploading 2016-04-15 10:17:22 -07:00
run_worker_csharp.sh switch C# benchmark to coreclr 2016-10-14 16:44:49 +02:00
run_worker_go.sh set GOPATH when executing go worker 2016-05-11 12:26:39 -07:00
run_worker_java.sh add java performance worker 2016-04-19 11:43:33 -07:00
run_worker_node.sh Improve Node and libuv testing and test coverage 2017-02-17 12:10:26 -08:00
run_worker_python.sh Migrated python performance tests to use GA API 2016-07-06 19:26:09 -07:00
run_worker_ruby.sh make RVM ruby accessible by performance tests 2016-04-19 14:32:37 -07:00
scenario_config.py Support multiple threads per cq sharing, add tests 2017-05-23 09:20:56 -07:00
scenario_result_schema.json enable uploading server cpu usage data from performance tests to big query 2017-01-11 10:01:16 +00:00

README.md

Overview of performance test suite, with steps for manual runs:

For design of the tests, see http://www.grpc.io/docs/guides/benchmarking.html.

Pre-reqs for running these manually:

In general the benchmark workers and driver build scripts expect linux_performance_worker_init.sh to have been ran already.

To run benchmarks locally:

On remote machines, to start the driver and workers manually:

The run_performance_test.py top-level runner script can also be used with remote machines, but for e.g., profiling the server, it might be useful to run workers manually.

  1. You'll need a "driver" and separate "worker" machines. For example, you might use one GCE "driver" machine and 3 other GCE "worker" machines that are in the same zone.

  2. Connect to each worker machine and start up a benchmark worker with a "driver_port".

Comands to start workers in different languages:

Running benchmark workers for C-core wrapped languages (C++, Python, C#, Node, Ruby):
  • These are more simple since they all live in the main grpc repo.
$ cd <grpc_repo_root>
$ tools/run_tests/performance/build_performance.sh
$ tools/run_tests/performance/run_worker_<language>.sh
Running benchmark workers for gRPC-Java:
$ cd <grpc-java-repo>
$ ./gradlew -PskipCodegen=true :grpc-benchmarks:installDist
$ benchmarks/build/install/grpc-benchmarks/bin/benchmark_worker --driver_port <driver_port>
Running benchmark workers for gRPC-Go:
$ cd <grpc-go-repo>/benchmark/worker && go install
$ # if profiling, it might be helpful to turn off inlining by building with "-gcflags=-l"
$ $GOPATH/bin/worker --driver_port <driver_port>

Build the driver:

  • Connect to the driver machine (if using a remote driver) and from the grpc repo root:
$ tools/run_tests/performance/build_performance.sh

Run the driver:

  1. Get the 'scenario_json' relevant for the scenario to run. Note that "scenario json" configs are generated from scenario_config.py. The driver takes a list of these configs as a json string of the form: {scenario: <json_list_of_scenarios> } in its --scenarios_json command argument. One quick way to get a valid json string to pass to the driver is by running the run_performance_tests.py locally and copying the logged scenario json command arg.

  2. From the grpc repo root:

  • Set QPS_WORKERS environment variable to a comma separated list of worker machines. Note that the driver will start the "benchmark server" on the first entry in the list, and the rest will be told to run as clients against the benchmark server.

Example running and profiling of go benchmark server:

$ export QPS_WORKERS=<host1>:<10000>,<host2>,10000,<host3>:10000
$ bins/opt/qps_json_driver --scenario_json='<scenario_json_scenario_config_string>'

Example profiling commands

While running the benchmark, a profiler can be attached to the server.

Example to count syscalls in grpc-go server during a benchmark:

  • Connect to server machine and run:
$ netstat -tulpn | grep <driver_port> # to get pid of worker
$ perf stat -p <worker_pid> -e syscalls:sys_enter_write # stop after test complete

Example memory profile of grpc-go server, with go tools pprof:

  • After a run is done on the server, see its alloc profile with:
$ go tool pprof --text --alloc_space http://localhost:<pprof_port>/debug/heap