Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (36 sloc) 2.5 KB

Loadtest Instruction

Environment Setup

In order to run loadtest, you need to run your own GoQuarkChain clusters.

A convenient option is to Use Deploy Tool to Start Clusters.

Cluster Configuration

Key parameters in cluster config json file for loadtest:

  • ROOT/CONSENSUS_CONFIG/TARGET_BLOCK_TIME: root block interval
  • CHAINS/CONSENSUS_CONFIG/TARGET_BLOCK_TIME: minor block interval
  • CHAINS/GENESIS/GAS_LIMIT: minor block gas limit
  • CHAINS/SHARD_SIZE: number of shards per chain
  • GENESIS_DIR: location of account data; should be "../../tests/loadtest/accounts" if you start cluster under goquarkchain/cmd/cluster

Start Mining

Your clusters need to keep mining while loadtest is ongoing.

Run the following command to start mining, replacing 127.0.0.1 with the host IP where the master service is deployed if not execute locally:

curl -X POST -H 'content-type: application/json' --data '{"jsonrpc":"2.0","method":"setMining","params":[true],"id":0}' http://127.0.0.1:38491

If need to stop mining,

curl -X POST -H 'content-type: application/json' --data '{"jsonrpc":"2.0","method":"setMining","params":[false],"id":0}' http://127.0.0.1:38491

Generate Transactions

Trigger loadtest through createTransactions which requests the cluster to generate transactions on each shard. Remember to replace 127.0.0.1 with the host IP where the master service is deployed if not execute locally:

curl -X POST -H 'content-type: application/json' --data '{"jsonrpc": "2.0","method": "createTransactions","params": [{ "numTxPerShard": 10000,"xShardPercent": 0}],"id": 1}' http://127.0.0.1:38491

NOTE if xShardPercent > 0, make sure to mine at least one root block before send transactions, because the network should have at least one root block been mined before cross shard transaction can be handled, according to the default config.

Monitoring

Now you can monitor the TPS using the stats tool.

FAQ

Got "account for tps not ready" when generating Transactions?

Please check GENESIS_DIR in cluster_config_template.json that the path to loadtest.json is correctly set. If you start cluster under goquarkchain/cmd/cluster, "../../tests/loadtest/accounts" would work for you. Usually it takes a few seconds for the cluster to load accounts, so please make sure it is fully started before creating transactions and mining.

You can’t perform that action at this time.