Skip to content

Commit d340f43

Browse files
authored
add benchmark design reference doc (#684)
1 parent f1207ae commit d340f43

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Benchmark - Design
3+
---
4+
5+
# Benchmark - Design
6+
7+
The purpose of this document is to share the design adopted by BSC for characterizing its performance using close-to-real test scenarios.
8+
9+
**Nodes Design**
10+
11+
* A: Client(s) → Validator(s)
12+
* B: Client(s) → FullNode(s) → Validator(s)
13+
14+
Both are acceptable; but ***B is recommended***.
15+
16+
**Scenarios Design**
17+
18+
The ***default*** design mimics typical transactions in a DeFi application, and the weight parameters enhance the flexibility of adding/removing scenarios with minimal implementation effort.
19+
20+
| Scenarios | Weight |
21+
| ---| --- |
22+
| Native token (BNB) transfer | 10 |
23+
| Contract token (BEP20) transfer | 10 |
24+
| Wrapped Native token (WBNB) deposit | 5 |
25+
| Wrapped Native token (WBNB) withdraw | 5 |
26+
| UniswapV2 - AddLiquidity | 5 |
27+
| UniswapV2 - RemoveLiquidity | 5 |
28+
| UniswapV2 - SwapExactTokensForTokens | 30 |
29+
| UniswapV2 - SwapBNBForExactTokens | 30 |
30+
| \[***Optional***\] ERC721 mint/transfer | 5 |
31+
| \[***Optional***\] ERC1155 mint/Transfer | 5 |
32+
| \[***Optional***\] Blob transaction | 1 |
33+
| \[***Optional***\] EIP7702 transaction | 1 |
34+
| \[***Optional***\] user-defined contract for the evaluation of _CPU intensive operations_ | 100 |
35+
36+
**Data Design**
37+
38+
* 16 BEP20 tokens are created.
39+
* 24 trading pairs are created:
40+
* 8 of them are among BEP20 tokens, e.g. T0←→T8, T1←→T9, etc;
41+
* 16 of them are among native token and ERC20 tokens, e.g. BNB←→T0, BNB←→T1, etc;
42+
* Each active user is allocated native tokens, wrapped native tokens, and two BEP20 tokens forming a trading pair. All tokens are distributed equally across active users based on modulo operation results.
43+
* After token allocation, each active user can run any scenario listed above using their allocated tokens.
44+
* A group of distinct test users is pre-selected from active users to serve as load generators.
45+
* ***For transfer scenarios, we use either distinct "to" addresses to maximize the transaction parallelism or a limited set of "to" addresses to minimize it***.
46+
47+
**Data Volume**
48+
49+
* A: Generate 1M active users and set up the test scenarios with 100k+ blocks
50+
* B: Generate 25M active users and set up the test scenarios with 1.0M-2.5M blocks
51+
52+
Both are acceptable, but ***B is recommended as it includes more blocks, accounts and states changes, which provides insights into how storage growth impacts performance over time***.
53+
54+
**Evaluation Criteria**
55+
56+
* No node failures should occur during execution.
57+
* The number of transactions per block should be consistent with the transaction propagation rate to validators' mempools and the sending rate from the test client. And there should be no backlog in validators' mempools after the test client stops.
58+
* The empty block rate must be below 0.1%.
59+
* The failed transaction rate, including send-errors and zero-receipt-status transactions, must be less than 0.1%;
60+
* A block finality metric must be defined. For example, in BSC, the p90 block finality time must be less than 2 seconds;
61+
62+
**Contract Code Reference**
63+
64+
* BEP20: [https://bscscan.com/token/0x55d398326f99059ff775485246999027b3197955#code](https://bscscan.com/token/0x55d398326f99059ff775485246999027b3197955#code)
65+
* WBNB: [https://bscscan.com/address/0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c#code](https://bscscan.com/address/0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c#code)
66+
* UniswapV2: [https://github.com/Uniswap/v2-core](https://github.com/Uniswap/v2-core)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ nav:
145145
- Slash Rules: ./bnb-smart-chain/slashing/slash-rules.md
146146
- Slash Monitor: ./bnb-smart-chain/slashing/monitor.md
147147
- Cross Chain Bridge: ./bnb-smart-chain/cross-chain-bridge.md
148+
- Benchmark: ./bnb-smart-chain/benchmark/design-reference.md
148149
- FAQ: ./bnb-smart-chain/faq/index.md
149150
- opBNB:
150151
- opBNB: ./bnb-opbnb/index.md

0 commit comments

Comments
 (0)