Skip to content

Commit d1fdce7

Browse files
committed
doc(ckb-bench): init readme
1 parent 34dc1a1 commit d1fdce7

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

ckb-bench/README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# ckb-bench
2+
3+
## Usage
4+
5+
* `$ ckb-bench dispatch --help`
6+
7+
```
8+
dispatch capacity to users
9+
10+
USAGE:
11+
ckb-bench dispatch --capacity-per-cell <NUMBER> --cells-per-user <NUMBER> --data-dir <PATH> --n-users <NUMBER> --rpc-urls <URLS>...
12+
13+
OPTIONS:
14+
--capacity-per-cell <NUMBER> Capacity per cell
15+
--cells-per-user <NUMBER> Cells per user
16+
--data-dir <PATH> Data directory [default: ./data]
17+
--n-users <NUMBER> Number of users
18+
--rpc-urls <URLS>... CKB rpc urls, prefix with network protocol, delimited by comma, e.g.
19+
"http://127.0.0.1:8114,http://127.0.0.2.8114"
20+
```
21+
22+
* `$ ckb-bench bench --help`
23+
24+
```
25+
bench the target ckb nodes
26+
27+
USAGE:
28+
ckb-bench bench [FLAGS] --bench-time-ms <TIME> --data-dir <PATH> --n-inout <NUMBER> --n-users <NUMBER> --rpc-urls <URLS>... --tx-interval-ms <TIME>
29+
30+
FLAGS:
31+
--is-smoking-test Whether the target network is production network, like mainnet, testnet, devnet
32+
33+
OPTIONS:
34+
--bench-time-ms <TIME> Bench time period
35+
--data-dir <PATH> Data directory [default: ./data]
36+
--n-inout <NUMBER> input-output pairs of a transaction
37+
--n-users <NUMBER> Number of users
38+
--rpc-urls <URLS>... CKB rpc urls, prefix with network protocol, delimited by comma, e.g.
39+
"http://127.0.0.1:8114,http://127.0.0.2.8114"
40+
--tx-interval-ms <TIME> Interval of sending transactions in milliseconds
41+
```
42+
43+
## Getting Started
44+
45+
### Bench on Testnet
46+
47+
1. Assume the owner privkey is `af44a4755acccdd932561db5163d5c2ac025faa00877719c78bb0b5d61da8c94`. Make sure this address has enough capacity.
48+
49+
2. Generate 9000 users, dispatch them 1 cells per user, 7100000000 capacity per cell.
50+
51+
```shell
52+
CKB_BENCH_OWNER_PRIVKEY=af44a4755acccdd932561db5163d5c2ac025faa00877719c78bb0b5d61da8c94 \
53+
./target/release/ckb-bench dispatch \
54+
--data-dir data/ \
55+
--rpc-urls http://127.0.0.1:8111 \
56+
--capacity-per-cell 7100000000 \
57+
--cells-per-user 1 \
58+
--n-users 9000
59+
```
60+
61+
3. Bench 300 seconds, benched transactions type are 2-in-2-out, sending transaction interval is 10ms
62+
63+
```shell
64+
CKB_BENCH_OWNER_PRIVKEY=af44a4755acccdd932561db5163d5c2ac025faa00877719c78bb0b5d61da8c94 \
65+
./target/release/ckb-bench bench \
66+
--is-smoking-test \
67+
--data-dir data/ \
68+
--rpc-urls http://127.0.0.1:8111 \
69+
--bench-time-ms 300000 \
70+
--n-users 9000 \
71+
--n-inout 2 \
72+
--tx-interval-ms 10
73+
```
74+
75+
2. Cleanup. Collect cells back to owner.
76+
77+
```shell
78+
CKB_BENCH_OWNER_PRIVKEY=af44a4755acccdd932561db5163d5c2ac025faa00877719c78bb0b5d61da8c94 \
79+
./target/release/ckb-bench collect \
80+
--data-dir data/ \
81+
--rpc-urls http://127.0.0.1:8111 \
82+
--n-users 9000
83+
```

0 commit comments

Comments
 (0)