Taraxa-project / taraxa-node

Taraxa blockchain full node implementation
MIT License
39 stars 20 forks source link

Network-wide stress tests #1446

Open JakubFornadel opened 2 years ago

JakubFornadel commented 2 years ago

Task Description

Stress and load testing across the actual network to gauge performance.

Create stress test(script) to see our actual max TPS on localnet as well as devnet. As a side-task we could also measure performance and some bottle necks during such stress test

Epic Parent

mfrankovi commented 2 years ago

Some summary on the performance test and findings: Main metrics that I was after is TPS (transactions per second) that we can process. For start I just wanted to setup a single node network where I would generate large number of transactions and having node create dag/pbft blocks with this high load and execute them.

If we look at TPS of ethereum or bitcoin it is mainly defined by block size, block time and average tx size. It is easy to just change block size or block time in a protocol and accomplish larger tps.

In Taraxa currently we also have certain predefined parameters that affect how many transactions we process: For DAG blocks there is no concept of block time but the actual number of dag blocks produced in time is dependent on:

  1. Number of nodes eligible to produce dag blocks
  2. Dag efficiency targets defined by sortition.dag_efficiency_targets
  3. VRF/VDF setting defined by sortition.vrf and sortition.vdf params
  4. Network latency between nodes

It is very hard to calculate the actual DAG blocks rate in time from this other than testing with actual network.

As for the DAG blocks size currently we have two limits in DAG size:

  1. chain.dag.block_proposer.transaction_limit which is currently set to 250 which limits max number of transaction to 250 within one dag block
  2. chain.dag.gas_limit which defines the cumulative gas limit for all the transactions within dag block

As for the Pbft blocks, block time is defined with chain.pbft.lambda_ms_min time that defines how often we create pbft block Pbft block size is determined by:

  1. chain.pbft.gas_limit - defining the total gas limit for all dag blocks within pbft block
  2. chain.pbft.dag_blocks_size - defining maximum number of dag blocks level to fit within pbft block

So all of the parameters defined above affect the limit of TPS of our network. I have ran some tests with a single node and multiple nodes where I modified all of these parameter in allowing to put large number of transactions in dag blocks and allow producing large number of dag blocks. Once this is done there are two main bottlenecks in running such a test:

  1. Creating transactions
  2. EVM executing transactions

Creating transactions seems to actually be slower than EVM executing transactions. I have not checked why yet, but my assumption would be that signing transactions is slow. To be able to fully test the speed of EVM, I had to create large number of transactions in advance and only then insert those transactions is node. In that case I would get EVM processing about 18k transactions per second. So in trying to run any kind of tests it is important to take in consideration that transaction creation is not fast.

In the tests I did so far I did not notice any bottlenecks in networking or in processing blocks and transactions. As long as the network has enough bandwidth, network will always be much quicker in providing transactions/blocks than EVM can execute them.