You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.2 KiB

  1. # tm-bench
  2. Tendermint blockchain benchmarking tool:
  3. - [https://github.com/tendermint/tendermint/tree/master/tools/tm-bench](https://github.com/tendermint/tendermint/tree/master/tools/tm-bench)
  4. For example, the following: `tm-bench -T 30 -r 10000 localhost:26657`
  5. will output:
  6. ```
  7. Stats Avg StdDev Max Total
  8. Txs/sec 3981 1993 5000 119434
  9. Blocks/sec 0.800 0.400 1 24
  10. ```
  11. NOTE: **tm-bench only works with build-in `kvstore` ABCI application**. For it
  12. to work with your application, you will need to modify `generateTx` function.
  13. In the future, we plan to support scriptable transactions (see
  14. [\#1938](https://github.com/tendermint/tendermint/issues/1938)).
  15. ## Quick Start
  16. ### Docker
  17. ```
  18. docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint init
  19. docker run -it --rm -v "/tmp:/tendermint" -p "26657:26657" --name=tm tendermint/tendermint node --proxy_app=kvstore
  20. docker run -it --rm --link=tm tendermint/bench tm:26657
  21. ```
  22. ### Using binaries
  23. [Install Tendermint](https://github.com/tendermint/tendermint#install)
  24. then run:
  25. ```
  26. tendermint init
  27. tendermint node --proxy_app=kvstore
  28. tm-bench localhost:26657
  29. ```
  30. with the last command being in a separate window.
  31. ## Usage
  32. ```
  33. Tendermint blockchain benchmarking tool.
  34. Usage:
  35. tm-bench [-c 1] [-T 10] [-r 1000] [-s 250] [endpoints] [-output-format <plain|json> [-broadcast-tx-method <async|sync|commit>]]
  36. Examples:
  37. tm-bench localhost:26657
  38. Flags:
  39. -T int
  40. Exit after the specified amount of time in seconds (default 10)
  41. -broadcast-tx-method string
  42. Broadcast method: async (no guarantees; fastest), sync (ensures tx is checked) or commit (ensures tx is checked and committed; slowest) (default "async")
  43. -c int
  44. Connections to keep open per endpoint (default 1)
  45. -output-format string
  46. Output format: plain or json (default "plain")
  47. -r int
  48. Txs per second to send in a connection (default 1000)
  49. -s int
  50. The size of a transaction in bytes, must be greater than or equal to 40. (default 250)
  51. -v Verbose output
  52. ```
  53. ## How stats are collected
  54. These stats are derived by having each connection send transactions at the
  55. specified rate (or as close as it can get) for the specified time.
  56. After the specified time, it iterates over all of the blocks that were created
  57. in that time.
  58. The average and stddev per second are computed based off of that, by
  59. grouping the data by second.
  60. To send transactions at the specified rate in each connection, we loop
  61. through the number of transactions.
  62. If its too slow, the loop stops at one second.
  63. If its too fast, we wait until the one second mark ends.
  64. The transactions per second stat is computed based off of what ends up in the
  65. block.
  66. Note that there will be edge effects on the number of transactions in the first
  67. and last blocks.
  68. This is because transactions may start sending midway through when tendermint
  69. starts building the next block, so it only has half as much time to gather txs
  70. that tm-bench sends.
  71. Similarly the end of the duration will likely end mid-way through tendermint
  72. trying to build the next block.
  73. Each of the connections is handled via two separate goroutines.
  74. ## Development
  75. ```
  76. make get_vendor_deps
  77. make test
  78. ```