What are Profiles?
A profile is a collection of tasks that are executed during the benchmark. Each profile is a Python class that inherits from theBaseUser class (or protocol-specific user classes like EvmUser or SolanaUser) and defines the RPC methods to call during the load test.
Profiles allow you to simulate realistic workloads by defining which blockchain RPC methods to call, how frequently to call them, and with what parameters.
Built-in Profiles
Chainbench includes profiles for many popular blockchains:- Ethereum:
ethereum.general,ethereum.consensus,ethereum.subscriptions - EVM chains:
evm.light,evm.heavy,evm.get_logs,evm.debug_trace - BNB Smart Chain:
bsc.general - Polygon:
polygon.general - Avalanche:
avalanche.general,avalanche.archive - Base:
base.general,base.archive - Arbitrum:
arbitrum.general,arbitrum.archive - Optimism:
optimism.general,optimism.archive - Solana:
solana.general,solana.all - And many more
Profile Structure
A basic profile consists of:- User class - Inherits from a protocol-specific base class
- Wait time - Defines pacing between requests
- Tasks/RPC calls - Methods to execute with optional weights
Simple Profile Example
Here’s theevm.light profile which tests common read operations:
Task Weights
Weights determine how frequently each task is executed relative to others. Higher weights mean more frequent execution.Weighted Profile Example
Weighted Profile Example
The In this example,
bsc.general profile uses weights based on real-world usage patterns:eth_call will be executed 33 times more frequently than eth_get_block_by_hash.Wait Times
Wait time controls the pacing between requests. Chainbench uses Locust’s wait time functions:constant_pacing
Maintains a constant request rate by adjusting wait time based on response time:With
constant_pacing(1), the wait time is calculated as 1 - response_time. If the response takes longer than 1 second, the next request is sent immediately.Other Wait Time Options
Locust supports other wait time strategies:constant(seconds)- Fixed wait time between requestsbetween(min, max)- Random wait time between min and max- Custom functions for advanced control
Custom Profiles
For detailed instructions on creating custom profiles, see the Creating Custom Profiles guide.
- Creating a Python file in your profiles directory
- Defining a class that inherits from
EvmUser,SolanaUser, orBaseUser - Adding tasks with the
@taskdecorator or using therpc_callsdictionary - Using parameter factories for dynamic test data
Task-based Profile Example
Here’s an example using the@task decorator:
Running Profiles
To run a benchmark with a specific profile:Profile Location
Default profiles are located in thechainbench/profile directory, organized by blockchain: