github.com/cgcardona/r-subnet-evm@v0.1.5/cmd/simulator/README.md (about)

     1  # Load Simulator
     2  
     3  When building developing your own blockchain using `subnet-evm`, you may want to analyze how your fee parameterization behaves and/or how many resources your VM uses under different load patterns. For this reason, we developed `cmd/simulator`. `cmd/simulator` lets you drive arbitrary load across any number of [endpoints] with a user-specified `keys` directory (insecure) `timeout`, `workers`, `max-fee-cap`, and `max-tip-cap`.
     4  
     5  ## Building the Load Simulator
     6  
     7  To build the load simulator, navigate to the base of the simulator directory:
     8  
     9  ```bash
    10  cd $GOPATH/src/github.com/cgcardona/r-subnet-evm/cmd/simulator
    11  ```
    12  
    13  Build the simulator:
    14  
    15  ```bash
    16  go build -o ./simulator main/*.go
    17  ```
    18  
    19  To confirm that you built successfully, run the simulator and print the version:
    20  
    21  ```bash
    22  ./simulator --version
    23  ```
    24  
    25  This should give the following output:
    26  
    27  ```
    28  v0.1.0
    29  ```
    30  
    31  To run the load simulator, you must first start an EVM based network. The load simulator works on both the C-Chain and Subnet-EVM, so we will start a single node network and run the load simulator on the C-Chain.
    32  
    33  To start a single node network, follow the instructions from the AvalancheGo [README](https://github.com/ava-labs/avalanchego#building-avalanchego) to build from source.
    34  
    35  Once you've built AvalancheGo, open the AvalancheGo directory in a separate terminal window and run a single node non-staking network with the following command:
    36  
    37  ```bash
    38  ./build/avalanchego --sybil-protection-enabled=false --network-id=local
    39  ```
    40  
    41  WARNING:
    42  
    43  The staking-enabled flag is only for local testing. Disabling staking serves two functions explicitly for testing purposes:
    44  
    45  1. Ignore stake weight on the P-Chain and count each connected peer as having a stake weight of 1
    46  2. Automatically opts in to validate every Subnet
    47  
    48  Once you have AvalancheGo running locally, it will be running an HTTP Server on the default port `9650`. This means that the RPC Endpoint for the C-Chain will be http://127.0.0.1:9650/ext/bc/C/rpc and ws://127.0.0.1:9650/ext/bc/C/ws for WebSocket connections.
    49  
    50  Now, we can run the simulator command to simulate some load on the local C-Chain for 30s:
    51  
    52  ```bash
    53  ./simulator --timeout=1m --workers=1 --max-fee-cap=300 --max-tip-cap=10 --txs-per-worker=50
    54  ```
    55  
    56  ## Command Line Flags
    57  
    58  To see all of the command line flag options, run
    59  
    60  ```bash
    61  ./simulator --help
    62  ```