Overview
Profiles define which blockchain methods to test and their relative weights in a load test. Chainbench comes with built-in profiles for multiple blockchains and supports custom profile creation.Built-in Profiles
Chainbench includes pre-configured profiles for various blockchain networks:- Ethereum:
ethereum.general,evm.light,evm.heavy - Binance Smart Chain:
bsc.general - Polygon:
polygon.general - Solana:
solana.general - Other EVM chains:
base,arbitrum,avalanche,fantom,gnosis,oasis,optimism,ronin - Starknet: Partial support available
Listing Available Profiles
To see all available profiles:Profile Directory Structure
Profiles are Python files (locustfiles) organized in a directory structure. Chainbench supports up to one level of subdirectories.Default Profile Location
The default profile directory is:Profile Naming Convention
Profiles use dot notation to reference subdirectories:ethereum.general→profile/ethereum/general.pyevm.light→profile/evm/light.pybsc.general→profile/bsc/general.py
myprofile→profile/myprofile.py
Using Profiles
With the —profile Flag
Specify a profile by name:With Custom Profile Directory
Use the-d or --profile-dir flag to specify a custom directory:
/path/to/profiles/custom/profile.py.
With Direct Profile Path
Use--profile-path to specify the exact file path:
The
--profile-path flag overrides both --profile and --profile-dir options.Profile Discovery
How Profiles Are Found
- Default location: If no directory is specified, Chainbench looks in the built-in
profile/directory - Custom directory: When using
--profile-dir, Chainbench scans that directory and one level of subdirectories - Direct path: When using
--profile-path, the exact file is used
Profile Validation
When you specify a profile, Chainbench validates:- The profile directory exists
- The profile file exists at the expected path
- The profile file is a valid locustfile
If a profile cannot be found, Chainbench will display an error message with suggestions:
Creating Custom Profiles
Custom profiles are Python files that define Locust user classes with blockchain-specific tasks.Profile Structure
A basic profile contains:- Imports: Required Chainbench and Locust classes
- User class: Inherits from
EvmUserorSolanaUser - Tasks: Methods decorated with
@taskthat define RPC calls - Weights: Optional task weights to control frequency
Example Profile
Organizing Custom Profiles
Create a directory structure for your profiles:Profile vs Method Testing
Testing a Single Method
You can test a single method without a profile:When using the method argument,
--profile and --profile-dir options are ignored.Testing Multiple Methods (Profile)
Profiles allow testing multiple methods with specific weights:Web UI Mode with Profiles
Class Picker Mode
When running without specifying a profile or method, Chainbench enables class picker mode in the Web UI:- Select which user classes to run
- Choose multiple profiles interactively
- Adjust user distribution in the UI
All profiles in the directory must use the same test data type (e.g., all EVM or all Solana).
Mixed Test Data Types
If you specify a directory with multiple test data types (e.g., both EVM and Solana profiles), you’ll see an error:Advanced Profile Features
Task Tags
Profiles can use tags to categorize tasks:Test Data Types
Profiles are associated with test data types:- EvmUser: For EVM-compatible chains (Ethereum, BSC, Polygon, etc.)
- SolanaUser: For Solana blockchain
- StarknetUser: For Starknet (partial support)
Best Practices
Profile Organization
Profile Organization
- Group related profiles in subdirectories (e.g.,
custom/light,custom/heavy) - Use descriptive names that indicate the profile purpose
- Keep one level of nesting for simplicity
- Document each profile with docstrings
Task Weights
Task Weights
- Assign higher weights to methods called more frequently in production
- Start with realistic production distributions
- Adjust weights based on observed traffic patterns
- Consider using separate profiles for different scenarios (e.g., read-heavy vs. write-heavy)
Profile Testing
Profile Testing
- Test new profiles with small data sizes first (
--size XS) - Validate against test nodes before production
- Start with low user counts and gradually increase
- Monitor resource usage on both client and server
Profile Maintenance
Profile Maintenance
- Keep profiles updated with new blockchain methods
- Remove deprecated methods from older profiles
- Version control your custom profiles
- Share successful profiles with your team
Troubleshooting
Profile Not Found
If you see a “profile not found” error:- Verify the profile name is correct (use
chainbench list profiles) - Check that the file exists at the expected path
- Ensure the file has a
.pyextension - Verify directory permissions
Multiple Test Data Types Error
If testing a directory with mixed types:- Specify a specific profile:
--profile evm.light - Use a directory with only one test data type
- Test a single method instead:
chainbench start eth_blockNumber
Profile Loading Errors
If a profile fails to load:- Check Python syntax in the profile file
- Ensure all required imports are present
- Verify the user class inherits from the correct base class
- Check for missing task decorators
Examples
Using Built-in Profile
Using Custom Profile Directory
Using Direct Profile Path
Web UI with Class Picker
http://localhost:8089 to select profiles interactively.