Benchmarking MoeingEVM and MoeingADS
After benchmarking the MoeingADS using ESC Chain, which can only send tokens, you may be curious about how it performs on smart contracts. So now we introduce how to run benchmarks to test the performance of calling smart contracts with MoeingEVM and MoeingADS.
We simulate such a scenario that 100% of CPU resource is used for verifying the transactions in blocks. As Vitalik Buterin pointed out, it is better for a node to put only 10% of CPU resource in verifying blocks. So if we want to reach the "one billion gas every 15 seconds" target, we'd better make sure the performance of solely verifying blocks can reach about 10 billion gas every 15 seconds.
We use the following simple contract for benchmarking, because its behavior is quite easy to understand. You can find it at https://github.com/smartbch/smartbch/blob/main/testdata/basic/contracts/Stress.sol
The gas consumption of calling the functions is not fixed. When new storage slots are created, the gas consumption is high and when only existing slots get updated, the gas consumption is low.
The benchmark's source code can be found at https://github.com/smartbch/smartbch/blob/main/cmd/stresstest/stress.go .
We selected four instances on AWS for the benchmark:
r6gd.2xlarge: Amazon Graviton2 Processor, 8 vCPUs, 64GB DRAM, 475GB SSD
m6gd.2xlarge: Amazon Graviton2 Processor, 16 vCPUs, 64GB DRAM, 950GB SSD
c6gd.2xlarge: Amazon Graviton2 Processor, 32 vCPUs, 64GB DRAM, 1900GB SSD
m5ad.4xlarge: AMD EPYC Processor, 16 vCPUs, 64GB DRAM, 600GB SSD
Now let's run this benchmark. The whole process takes more than 20 hours, so please be patient.
Step 0: please follow this document and finish all the steps.
Step 1: generate some random private keys into the file "keys60M.txt":
Step 2: generate several blocks filled with random transactions:
Step 3: replay the transactions in the generated blocks:
The generated transactions can be categorized into three groups:
Deploy the smart contracts
Initialize the storage slots and the target addresses, using the
run0
functionTransfer random amount of BCHs to the randomly-selected target addresses and overwrite some storage slots randomly, using the
run2
function
The benchmarks are written in such a way that transactions in group 2 always create new storage slots while transactions in group 3 always overwrite existing storage slots. Most real transactions' behavior is at some position in between: they both create new slots and overwrite existing slots.
These three groups of transactions are carried out in sequence. We care about the performance of group 3 and the last part of group 2. Because when these transactions get executed, MoeingADS has already taken a lot of SSD space (200GB+) which is too large for OS to cache it in DRAM.
The gathered results are:
r6gd.2xlarge
0.21
0.57
m6gd.4xlarge
0.34
0.86
c6gd.8xlarge
0.43
1.01
m5ad.4xlarge
0.29
0.77
When CPU count increases from 8 to 16, the speed-up is obvious; but when from 16 to 32, the speed-up is not so obvious. This is because there are some jobs which cannot be parallelized.
We can see that 16 Graviton2 vCPUs are faster than 16 EPYC vCPUs. This is because a vCPU of Graviton2 is a physical core, while a vCPU of EPYC is just one thread of the two threads running on a physical core.
According the results, m6gd.4xlarge has the best price/cost: it burns 5.1~12.9 billion gas in 15 seconds, and its price is lower than m5ad.4xlarge.
Last updated