Skip to main content

k6 pause/resume/scale

Control a running k6 test through REST API commands.

Description

While a k6 test is running with the k6 run command, it exposes a REST API that allows you to:
  • Pause - Temporarily stop test execution
  • Resume - Continue a paused test
  • Scale - Dynamically adjust the number of VUs
These commands interact with the k6 REST API server (default: localhost:6565).
These commands are hidden and primarily intended for advanced use cases. Most users should configure tests upfront rather than dynamically controlling them.

k6 pause

Synopsis

Description

Pause a currently running test. When paused:
  • VUs stop executing new iterations
  • Current iterations complete
  • The test timer continues
  • Metrics collection continues

Examples

Use Cases

  • Debug issues during test execution
  • Wait for external system stabilization
  • Manually control test phases

k6 resume

Synopsis

Description

Resume a paused test. VUs will continue executing iterations from where they left off.

Examples

k6 scale

Synopsis

Description

Dynamically scale the number of VUs in a running test. You can adjust:
  • Active VUs (--vus) - Currently executing VUs
  • Max VUs (--max) - VU capacity/pool size
At least one of --vus or --max must be specified.

Examples

Flags

int
Number of virtual users to scale to. Must be less than or equal to max VUs.
int
Maximum available virtual users. This sets the VU pool capacity.

Constraints

  • Active VUs cannot exceed max VUs
  • Cannot scale beyond resource limits
  • Some executors don’t support dynamic scaling

Global Flags

All control commands support:
string
default:"localhost:6565"
Address of the k6 REST API server

REST API Endpoints

These commands are wrappers around REST API calls:

PATCH /v1/status

The underlying API endpoint for all control operations:

Output

All commands return the current test status in YAML format:
Fields:
  • status - Current test state (init, running, paused, finished)
  • paused - Whether the test is paused
  • vus - Current active VUs
  • vus-max - Maximum VU capacity
  • tainted - Whether the test has been modified during execution

Enabling the API Server

By default, the REST API is available on localhost:6565. To customize:
Set via environment variable:

Use Cases

Manual Load Testing

Manually control load during exploratory testing:

Reactive Scaling

Adjust load based on external metrics:

Debugging

Pause execution to investigate:

Coordinated Testing

Synchronize multiple test instances:

Limitations

Executor Compatibility

Not all executors support dynamic control: ⚠️ = Limited support (may conflict with ramping schedule)

State Consistency

When pausing/resuming:
  • Test duration continues
  • Iterations in progress complete
  • Some timing may be affected
  • Metrics reflect actual execution time

Resource Limits

Scaling is constrained by:
  • System memory
  • CPU cores
  • Network connections
  • File descriptors

See Also