-
Notifications
You must be signed in to change notification settings - Fork 114
Loadtest
Running loadtest on QuarkChain is simple.
-
Follow the instructions in README to setup environment and start a local cluster
pypy3 quarkchain/cluster/cluster.py --mine
-
Trigger loadtest through
createTransactions
JSON RPC which requests the cluster to generate transactions on each shard.numTxPerShard
<= 12000,xShardPercent
<= 100curl
curl -X POST --data '{"jsonrpc":"2.0","method":"createTransactions","params":{"numTxPerShard":10000, "xShardPercent":10},"id":0}' http://localhost:38491
python
python -c 'import jsonrpcclient; jsonrpcclient.request("http://localhost:38491", "createTransactions", numTxPerShard=10000, xShardPercent=10)'
Then you should see the following output from cluster.py
MASTER: I0920 16:38:30.528915 jsonrpc.py:416] {"jsonrpc": "2.0", "method": "createTransactions", "params": {"numTxPerShard": 10000, "xShardPercent": 10}, "id": 1} SLAVE_S1: I0920 16:38:30.534065 tx_generator.py:50] [1] start generating 10000 transactions with 10% cross-shard SLAVE_S0: I0920 16:38:30.534153 tx_generator.py:50] [0] start generating 10000 transactions with 10% cross-shard SLAVE_S2: I0920 16:38:30.534152 tx_generator.py:50] [2] start generating 10000 transactions with 10% cross-shard SLAVE_S3: I0920 16:38:30.535326 tx_generator.py:50] [3] start generating 10000 transactions with 10% cross-shard SLAVE_S3: I0920 16:38:37.022581 tx_generator.py:50] [7] start generating 10000 transactions with 10% cross-shard SLAVE_S0: I0920 16:38:37.071729 tx_generator.py:50] [4] start generating 10000 transactions with 10% cross-shard SLAVE_S1: I0920 16:38:37.116436 tx_generator.py:50] [5] start generating 10000 transactions with 10% cross-shard SLAVE_S2: I0920 16:38:37.237476 tx_generator.py:50] [6] start generating 10000 transactions with 10% cross-shard
-
At your virtual environment, monitor the TPS using the
stats
tool.source ~/virtualenv/qc/bin/activate quarkchain/tools/stats --ip=localhost ---------------------------------------------------------------------------------------------------- QuarkChain Cluster Stats ---------------------------------------------------------------------------------------------------- CPU: 8 Memory: 16 GB IP: localhost Shards: 8 Servers: 4 Shard Interval: 60 Root Interval: 10 Syncing: False Mining: False Peers: 127.0.0.1:38293, 127.0.0.1:38292 ---------------------------------------------------------------------------------------------------- Timestamp TPS Pending tx Confirmed tx BPS SBPS ROOT CPU ---------------------------------------------------------------------------------------------------- 2018-09-21 16:35:07 0.00 0 0 0.00 0.00 84 12.50 2018-09-21 16:35:17 0.00 0 9000 0.02 0.00 84 7.80 2018-09-21 16:35:27 0.00 0 18000 0.07 0.00 84 6.90 2018-09-21 16:35:37 0.00 0 18000 0.07 0.00 84 4.49 2018-09-21 16:35:47 0.00 0 18000 0.10 0.00 84 6.10
Loadtest Accounts
12,000 loadtest accounts are loaded into genesis alloc config for each shard.
JSON RPC
JSON RPCs are defined in jsonrpc.py
. Note that there are two JSON RPC ports. By default they are 38491 for private RPCs and 38391 for public RPCs. Since you are running your own clusters you get access to both.
Command Line Flags
Command line flags are defined in cluster_config.py
. Some interesting ones regarding loadtest:
-
--num_shards
(default 8) defines the number of shards in the cluster (must be power of 2) -
--num_slaves
(default 4) defines the number of slave servers in the cluster. Each slave server can serve one or more shards. Since each slave server is an independent process, you may want to make this equal to--num_shards
to utilize as many CPU cores as possible. -
--root_block_interval_sec
(default 10) defines the target block interval of root chain -
--minor_block_interval_sec
(default 3) defines the target block interval on each shard -
--mine
enables mining as soon as the cluster starts. Mining can also be toggled at runtime throughsetMining
JSON RPC. -
--clean
clears any existing data to start a fresh cluster from genesis
Official Website: https://www.quarkchain.io/
Discord Developer Community: https://discord.me/quarkchain