No project description provided
Project description
Chainstack is the leading suite of services connecting developers with Web3 infrastructure
• Homepage •
Supported protocols •
Chainstack blog •
Chainstack docs •
Blockchain API reference •
• Start for free •
Chainbench
This project allows you to benchmark your blockchain infrastructure. It uses Locust under the hood.
Project Details
Chainbench lets you to easily define profiles for any EVM-compatible chain. You can use not only hard-coded values but also real chain data to generate dynamic call parameters.
Main features:
- Built-in profiles for Ethereum, Binance Smart Chain, Polygon, Oasis, and Avalanche
- Support for custom profiles
- Dynamic call params generation using real chain data
- Headless and web UI modes
Check out the docs for more information about the profile creation.
Prerequisites
- Python 3.10+
- Poetry 1.2+ (installation instructions here)
Installation
Using pip
⚠️ Installation using pip is not supported yet.
Using Poetry
Clone the repository:
git clone git@github.com:chainstacklabs/chainbench.git
Install dependencies:
cd chainbench && poetry install --without dev
You might need to run the following command before running the tool:
poetry shell
Example Usage
To learn about the parameters and flags, run the following command:
python3 -m chainbench start --help
Basic usage is:
python3 -m chainbench start --profile bsc --users 50 --workers 2 --test-time 12h --target https://node-url --headless --autoquit
This will run a load test for BSC with 2 workers, 50 users and 12 hours test time in headless mode. After the test is finished, the tool will automatically quit.
Parameters and Flags
--profile
: This flag specifies the profile to use for the benchmark. Available profiles areethereum
,bsc
,polygon
,oasis
, andavalanche
.--users
: This flag sets the number of simulated users to use for the benchmark.--workers
: This flag sets the number of worker threads to use for the benchmark.--test-time
: This flag sets the duration of the test to run.--target
: This flag specifies the target blockchain node URL that the benchmark will connect to.--headless
: This flag runs the benchmark in headless mode, meaning that no graphical user interface (GUI) will be displayed during the test. This is useful for running the test on a remote server or when the GUI is not needed.--autoquit
: This flag tells the Chainbench tool to automatically quit after the test has finished. This is useful for running the benchmark in an automated environment where manual intervention is not desired.--help
: This flag displays the help message.
Profiles
Profiles are located in the profile
directory. For a tutorial on how to create custom profiles, please refer to this document.
Web UI Mode
Run the following command to run a load test for BSC in UI mode. It will start a web server on port 8089. Target is not required as you can specify it in the UI along with the number of users, spawn rate and test time.
python3 -m chainbench start --profile bsc --workers 1
Headless Mode
If you want to run a load test for BSC in headless mode, run the following command:
python3 -m chainbench start --profile bsc --workers 4 --users 100 --test-time 1h --target https://node-url --headless --autoquit
It will run a load test for BSC with 4 workers, 100 users and 1 hour test time.
In practice, you will probably want to run the benchmark on a remote server. Here's the example utilizing nohup
:
nohup python3 -m chainbench start --profile bsc --workers 4 --users 100 --test-time 1h --target https://node-url --headless --autoquit &
License
This project is licensed under the Apache 2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for chainbench-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a3e356689b4456c3f7a8a4d69c2dd823d78986025b0fd14f96701f0be31acd5 |
|
MD5 | 5cc95f48cae6bf8e994dd2c21b1af4f5 |
|
BLAKE2b-256 | 72376ff9c66a1e13a9cd809b8b8fea1469c4a09e1ac661c58214523ad287ff3d |