run_perf_unconstrained.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. # Copyright 2016 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # format argument via
  16. # $ echo '{...}' | python -mjson.tool
  17. read -r -d '' SCENARIOS_JSON_ARG <<'EOF'
  18. {
  19. "scenarios": [
  20. {
  21. "benchmark_seconds": 60,
  22. "warmup_seconds": 5,
  23. "client_config": {
  24. "client_channels": 100,
  25. "client_type": "ASYNC_CLIENT",
  26. "histogram_params": {
  27. "max_possible": 60000000000.0,
  28. "resolution": 0.01
  29. },
  30. "load_params": {
  31. "closed_loop": {}
  32. },
  33. "outstanding_rpcs_per_channel": 100,
  34. "payload_config": {
  35. "simple_params": {
  36. "req_size": 0,
  37. "resp_size": 0
  38. }
  39. },
  40. "rpc_type": "UNARY",
  41. "security_params": null
  42. },
  43. "name": "name_goes_here",
  44. "num_clients": 1,
  45. "num_servers": 1,
  46. "server_config": {
  47. "security_params": null,
  48. "server_type": "ASYNC_SERVER"
  49. },
  50. "spawn_local_worker_count": -2
  51. }
  52. ]
  53. }
  54. EOF
  55. set -ex
  56. cd $(dirname $0)/../../..
  57. CPUS=`python -c 'import multiprocessing; print multiprocessing.cpu_count()'`
  58. # try to use pypy for generating reports
  59. # each trace dumps 7-8gig of text to disk, and processing this into a report is
  60. # heavyweight - so any speed boost is worthwhile
  61. # TODO(ctiller): consider rewriting report generation in C++ for performance
  62. if which pypy >/dev/null; then
  63. PYTHON=pypy
  64. else
  65. PYTHON=python2.7
  66. fi
  67. export config=mutrace
  68. make CONFIG=$config -j$CPUS qps_json_driver
  69. sudo perf record -F 997 -g bins/$config/qps_json_driver --scenarios_json="$SCENARIOS_JSON_ARG"
  70. sudo perf report