kar98k uses YAML configuration files. This document describes all available options.
targets:
- name: api-health
url: http://localhost:8080/api/health
protocol: http
method: GET
weight: 50
timeout: 10s
- name: api-users
url: http://localhost:8080/api/users
protocol: http
method: GET
headers:
Authorization: "Bearer ${API_TOKEN}"
Content-Type: "application/json"
weight: 30
timeout: 15s
- name: api-data
url: http://localhost:8080/api/data
protocol: http
method: POST
headers:
Content-Type: "application/json"
body: '{"query": "test"}'
weight: 20
timeout: 20s
controller:
base_tps: 100
max_tps: 1000
ramp_up_duration: 30s
shutdown_timeout: 30s
schedule:
- hours: [9, 10, 11, 12, 13, 14, 15, 16, 17]
tps_multiplier: 1.5
- hours: [12, 13]
tps_multiplier: 2.0
- hours: [0, 1, 2, 3, 4, 5]
tps_multiplier: 0.3
pattern:
poisson:
enabled: true
lambda: 0.005
spike_factor: 2.5
min_interval: 2m
max_interval: 10m
ramp_up: 5s
ramp_down: 10s
noise:
enabled: true
amplitude: 0.10
worker:
pool_size: 1000
queue_size: 10000
max_idle_conns: 100
idle_conn_timeout: 90s
health:
enabled: true
interval: 10s
timeout: 5s
metrics:
enabled: true
address: ":9090"
path: "/metrics"List of target endpoints to send traffic to.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | Yes | - | Unique identifier for the target |
url |
string | Yes | - | Full URL including protocol and path |
protocol |
string | No | http |
Protocol: http, http2, or grpc |
method |
string | No | GET |
HTTP method |
headers |
map | No | - | Request headers |
body |
string | No | - | Request body |
weight |
int | No | 100 |
Relative weight for load distribution |
timeout |
duration | No | 30s |
Request timeout |
Controls the main traffic generation behavior.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base_tps |
float | No | 100 |
Baseline transactions per second |
max_tps |
float | No | 1000 |
Maximum TPS cap |
ramp_up_duration |
duration | No | 30s |
Time to reach base TPS on startup |
shutdown_timeout |
duration | No | 30s |
Max time to wait for graceful shutdown |
schedule |
list | No | - | Time-of-day TPS multipliers |
| Field | Type | Description |
|---|---|---|
hours |
list[int] | Hours (0-23) when this multiplier applies |
tps_multiplier |
float | Multiplier to apply to base TPS |
Controls traffic pattern generation.
Poisson distribution for random traffic spikes.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
enabled |
bool | No | true |
Enable Poisson spikes |
lambda |
float | No | 0.005 |
Average spikes per second |
spike_factor |
float | No | 2.5 |
TPS multiplier during spikes |
min_interval |
duration | No | 2m |
Minimum time between spikes |
max_interval |
duration | No | 10m |
Maximum time between spikes |
ramp_up |
duration | No | 5s |
Time to reach peak spike |
ramp_down |
duration | No | 10s |
Time to return to baseline |
Micro fluctuations for realistic traffic.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
enabled |
bool | No | true |
Enable noise |
amplitude |
float | No | 0.10 |
Fluctuation range (0.10 = ±10%) |
Worker pool configuration.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
pool_size |
int | No | 1000 |
Maximum concurrent workers |
queue_size |
int | No | 10000 |
Request queue size |
max_idle_conns |
int | No | 100 |
HTTP keep-alive connections |
idle_conn_timeout |
duration | No | 90s |
Connection idle timeout |
Health checker configuration.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
enabled |
bool | No | true |
Enable health checking |
interval |
duration | No | 10s |
Health check interval |
timeout |
duration | No | 5s |
Health check timeout |
Prometheus metrics configuration.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
enabled |
bool | No | true |
Enable metrics endpoint |
address |
string | No | :9090 |
Listen address |
path |
string | No | /metrics |
Metrics endpoint path |
You can use environment variables in the configuration:
headers:
Authorization: "Bearer ${API_TOKEN}"Note: Environment variable substitution must be handled by your deployment system (e.g., Docker Compose, Kubernetes).
kar98k validates the configuration on startup:
- At least one target is required
base_tpsmust be positivemax_tpsmust be >=base_tpspoisson.lambdamust be positive if enabledpoisson.spike_factormust be >= 1noise.amplitudemust be between 0 and 1worker.pool_sizemust be positive