Skip to main content
Load testing assesses how your system performs under expected normal and peak load conditions. It helps you understand capacity, identify bottlenecks, and validate that your system meets performance requirements.

Purpose

Load tests help you:
  • Measure response times under typical load
  • Identify performance bottlenecks
  • Validate system capacity and scalability
  • Ensure SLAs are met under normal conditions

Configuration Pattern

Load tests use ramping stages to gradually increase load:
The stages configuration above creates a classic load test profile: gradual ramp-up, steady state, and controlled ramp-down.

Using the Ramping VUs Executor

The ramping-vus executor provides fine-grained control over VU ramping:

Ramp Up

2-5 minutes to target load

Steady State

5-15 minutes at peak load

Ramp Down

2-5 minutes to zero

Load Test Stages Explained

1

Ramp Up

Gradually increase VUs to give the system time to scale and warm up caches. This prevents overwhelming the system immediately.
2

Steady State

Maintain peak load to measure sustained performance. This is where you gather meaningful metrics.
3

Ramp Down

Gracefully reduce load to allow the system to recover and finish processing requests.

Advanced Load Testing Pattern

Multi-stage load test with multiple peaks:

Using Constant Arrival Rate

For more realistic load patterns, use arrival rate instead of VUs:
Arrival rate executors maintain a constant request rate regardless of response times, providing more realistic load simulation.

Metrics to Monitor

Key Performance Indicators

  • Response time percentiles: p(95), p(99)
  • Request rate: Requests per second
  • Error rate: Failed requests percentage
  • Throughput: Data transferred

Setting Thresholds

Best Practices

Load Test Duration

Minimum Duration

Run for at least 15-20 minutes to observe steady-state behavior

Recommended Duration

30-60 minutes for comprehensive testing

Realistic User Behavior

Add sleep() calls to simulate realistic user think time between requests. Without sleep, k6 will execute requests as fast as possible.

When to Use

  • Pre-production: Validate performance before releases
  • Capacity planning: Determine maximum sustainable load
  • SLA validation: Ensure performance requirements are met
  • Baseline establishment: Create performance benchmarks

Common Patterns

Gradual Load Increase

Test multiple load levels in one test: