What are Load Shapes?
Load shapes define how the number of simulated users changes over the duration of a test. Instead of maintaining a constant number of users, you can use load shapes to simulate realistic traffic patterns like gradual ramp-ups, stepped increases, or sudden spikes.Available Shapes
Chainbench includes several built-in load shapes:- ramp-up (default): Linear increase to target users, then constant
- step: Increases in discrete steps
- spike: Spikes to full load and back down
Default Shape: Ramp-Up
When no shape is specified, Chainbench uses the default ramp-up pattern:- Users spawn at the specified
--spawn-rate - Load increases linearly until
--usersis reached - Maintains that user count until test duration expires
With 100 users and spawn rate 10, users will ramp up over 10 seconds (10 users/second), then maintain 100 users for the remaining test time.
Step Shape
The step shape increases load in discrete steps, useful for testing how the system responds to incremental load increases.How It Works
- Number of steps =
--users÷--spawn-rate - Duration per step =
--test-time÷ number of steps - Each step adds
--spawn-rateusers
Example
- 5 steps (100 ÷ 20)
- Each step lasts 6 minutes (30m ÷ 5)
- Users: 20 → 40 → 60 → 80 → 100
Step Shape Implementation
Step Shape Implementation
Spike Shape
The spike shape simulates sudden traffic bursts, useful for testing system resilience under spike conditions.Pattern
- 40% of duration: 10% of target users (baseline)
- 20% of duration: 100% of target users (spike)
- 40% of duration: 10% of target users (recovery)
Example
- 0:00 - 4:00 (40%): 100 users (10% of 1000)
- 4:00 - 6:00 (20%): 1000 users (spike)
- 6:00 - 10:00 (40%): 100 users (recovery)
Spike Shape Implementation
Spike Shape Implementation
Use Cases by Shape
Ramp-Up (Default)
Best for:- Steady-state performance testing
- Finding maximum sustained throughput
- Long-duration stability tests
- General benchmarking
Step
Best for:- Identifying performance degradation points
- Finding breaking points
- Testing scaling behavior
- Observing gradual performance changes
Spike
Best for:- Testing resilience to traffic bursts
- Evaluating recovery time
- Stress testing
- Simulating real-world traffic patterns
Creating Custom Shapes
You can create custom load shapes by copying an existing shape and modifying it:- Copy a shape from
chainbench/shapes/ - Modify the
tick()method to define your pattern - Save to your custom shapes directory
- Use with
--shape custom-shape-name
Custom shapes must inherit from
LoadTestShape and implement the tick() method which returns (user_count, spawn_rate) or None when the test should end.Custom Shape Example
Combining Shapes with Profiles
Different load shapes work well with different profile types: Light profiles (evm.light):
- Can handle high user counts
- Good for all shape types
- Use for maximum load testing
evm.heavy):
- Use lower user counts
- Step shape helps identify limits
- Spike shape tests resilience
- May need custom shapes for realistic patterns
- Consider periodic access patterns
When using heavy profiles or expensive operations, start with lower user counts and shorter test times to avoid overwhelming your infrastructure.
Monitoring Shape Performance
When using shapes, monitor:- Response times at each load level
- Error rates during transitions
- Resource usage on the target node
- Recovery time after spike tests