Skip to content

Commit

Permalink
Add new RPC stress testing tool (lotus-bench rpc) with rich reporting
Browse files Browse the repository at this point in the history
This benchmark is designed to stress test the rpc methods of a lotus node so that we can simulate real world usage and measure the performance of rpc methods on the node.

This benchmark has the following features:
* Can query each method both sequentially and concurrently
* Supports rate limiting
* Can query multiple different endpoints at once (supporting different concurrency level and rate limiting for each method)
* Gives a nice reporting summary of the stress testing of each method (including latency distribution, histogram and more)
* Easy to use

To use this benchmark you must specify the rpc methods you want to test using the --method options, the format of it is:

  --method=NAME[:CONCURRENCY][:QPS][:PARAMS] where only METHOD is required.

Here are some real examples:
  lotus-bench rpc --method='eth_chainId' // run eth_chainId with default concurrency and qps
  lotus-bench rpc --method='eth_chainId:3'  // override concurrency to 3
  lotus-bench rpc --method='eth_chainId::100' // override to 100 qps while using default concurrency
  lotus-bench rpc --method='eth_chainId:3:100' // run using 3 workers but limit to 100 qps
  lotus-bench rpc --method='eth_getTransactionCount:::["0xd4c70007F3F502f212c7e6794b94C06F36173B36", "latest"]' // run using optional params while using default concurrency and qps
  lotus-bench rpc --method='eth_chainId' --method='eth_getTransactionCount:10:0:["0xd4c70007F3F502f212c7e6794b94C06F36173B36", "latest"]' // run multiple methods at once`,

Fixes: #10752
  • Loading branch information
fridrik01 committed Apr 26, 2023
1 parent a3559ae commit fe614fc
Show file tree
Hide file tree
Showing 2 changed files with 488 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/lotus-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ func main() {
sealBenchCmd,
simpleCmd,
importBenchCmd,
rpcCmd,
},
DisableSliceFlagSeparator: true,
}

if err := app.Run(os.Args); err != nil {
Expand Down
Loading

0 comments on commit fe614fc

Please sign in to comment.