SLA Auto-Tuning#
The SLA (Service Level Agreement) auto-tuning feature allows users to define service quality metrics (such as latency and throughput), and the tool will automatically adjust request pressure (concurrency or request rate) to find the maximum pressure value that the service can sustain while meeting these metrics.
Features#
Automatic Detection: Uses binary search algorithm to automatically find the maximum concurrency (
parallel) or request rate (rate) that satisfies SLA constraints.Multi-Metric Support: Supports end-to-end latency (Latency), time to first token (TTFT), time per output token (TPOT), as well as request throughput (RPS) and token throughput (TPS).
Flexible Constraints: Supports setting upper limits (e.g.,
p99_latency <= 2s) or finding extremes (e.g.,tps: max).Stable Results: Each test point runs multiple times by default and takes the average to reduce network fluctuation interference.
Parameter Description#
Parameter |
Type |
Description |
Default |
|---|---|---|---|
|
|
Whether to enable SLA auto-tuning mode |
|
|
|
Variable for auto-tuning |
|
|
|
SLA constraint conditions, JSON string, supports multiple constraint groups (AND/OR logic), see description below |
|
|
|
Upper bound of the tuned SLA variable search range |
|
|
|
Lower bound of the tuned SLA variable search range |
|
|
|
Fixed parallel workers used when |
|
|
|
Number of repeated runs per test point (average taken to reduce fluctuation) |
|
|
|
Multiplier of total requests relative to the tuned variable (concurrency or rate), i.e. |
|
Supported Metrics and Operators#
Metric Category |
Metric Name |
Description |
Supported Operators |
|---|---|---|---|
Latency |
|
Average request latency |
|
|
99th percentile request latency |
|
|
|
Average time to first token |
|
|
|
99th percentile time to first token |
|
|
|
Average time per output token |
|
|
|
99th percentile time per output token |
|
|
Throughput |
|
Requests per second |
|
|
Tokens per second |
|
--sla-params Logic#
--sla-params accepts a JSON array, where each element is an object (group). Logic rules are as follows:
Multiple metrics within the same object: AND (must all be satisfied simultaneously)
Between different objects: OR (any one group satisfied is sufficient)
The overall semantics are: (Group1 ConditionA AND Group1 ConditionB) OR (Group2 ConditionC AND Group2 ConditionD) OR ...
AND Example: Satisfy TTFT and TPOT Simultaneously#
Write multiple metrics in the same object to indicate they must all be satisfied:
--sla-params '[{"avg_ttft": "<=2", "avg_tpot": "<=0.05"}]'
Meaning: Find the maximum concurrency satisfying avg_ttft <= 2s AND avg_tpot <= 0.05s. Only when both metrics are met does that concurrency level pass.
OR Example: Independently Evaluate Multiple TTFT Thresholds#
Write each metric in a different object so each group of conditions is evaluated independently:
--sla-params '[{"p99_ttft": "<0.05"}, {"p99_ttft": "<0.01"}]'
Meaning: Find the maximum request rate satisfying p99_ttft < 0.05s and satisfying p99_ttft < 0.01s separately, each outputting results independently.
AND + OR Combined Example#
--sla-params '[{"avg_ttft": "<=1", "avg_tpot": "<=0.05"}, {"p99_latency": "<=5"}]'
Meaning:
Group 1:
avg_ttft <= 1sANDavg_tpot <= 0.05s(both satisfied simultaneously)Group 2:
p99_latency <= 5sEach group independently completes a binary search and outputs its maximum concurrency value separately.
Extremum Optimization Mode#
When the array has only one object with only one metric, and the operator is max or min, the tool enters extremum optimization mode and directly finds the pressure value corresponding to the optimal metric:
--sla-params '[{"tps": "max"}]'
Meaning: Find the concurrency corresponding to maximum TPS (token throughput).
Workflow#
Baseline Test: Start testing with the user-specified initial
parallelorrate(recommended to set a small value, such as 1 or 2).Boundary Detection:
If current metrics meet SLA, double the pressure until SLA is first violated or
--sla-upper-boundis reached.If initial metrics violate SLA, halve the pressure to find a lower bound that satisfies conditions.
Binary Search: Perform binary search within the determined boundary window to precisely lock in the maximum pressure value that βjust doesnβt violateβ SLA.
Result Confirmation: Each test point runs
--sla-num-runstimes (default 3), taking the average for judgment.Report Output: After testing, output a summary of the tuning process and final results.
Note: If the request success rate during testing is below 100%, that test point will be considered failed (violating SLA).
When
--sla-variable=rate, use--sla-fixed-parallelto explicitly control the fixed concurrency. If not set, the implementation falls back to--sla-upper-boundfor backward compatibility.
Usage Examples#
1. Find Maximum Concurrency Meeting P99 Latency <= 2s#
evalscope perf \
--model Qwen2.5-0.5B-Instruct \
--tokenizer-path Qwen/Qwen2.5-0.5B-Instruct \
--url http://127.0.0.1:8801/v1/chat/completions \
--api openai \
--dataset random \
--max-tokens 1024 \
--prefix-length 0 \
--min-prompt-length 1024 \
--max-prompt-length 1024 \
--sla-auto-tune \
--sla-variable parallel \
--sla-params '[{"p99_latency": "<=2"}]' \
--parallel 2 \
--sla-upper-bound 64
Performance Overview
ββββββββ³βββββββ³ββββββ³βββββββ³ββββββββββ³ββββββββββ
βConc. β Rate β Num β RPS β Gen/s β Success β
β‘βββββββββββββββββββββββββββββββββββββββββββββββ©
β 2 β - β 20 β 2.19 β 640.20 β 100.0% β
β 4 β - β 20 β 7.18 β 1013.67 β 100.0% β
β 5 β - β 20 β 6.39 β 1210.93 β 100.0% β
β 6 β - β 20 β 3.86 β 1095.79 β 100.0% β
β 8 β - β 20 β 4.03 β 1615.33 β 100.0% β
ββββββββ΄βββββββ΄ββββββ΄βββββββ΄ββββββββββ΄ββββββββββ
2025-12-18 16:32:39 - evalscope - INFO: SLA Auto-tune Summary:
+--------------------+------------+-----------------+-----------+
| Criteria | Variable | Max Satisfied | Note |
+====================+============+=================+===========+
| p99_latency <= 2.0 | parallel | 5 | Satisfied |
+--------------------+------------+-----------------+-----------+
2. Find Concurrency with Maximum TPS#
evalscope perf \
--model Qwen2.5-0.5B-Instruct \
--tokenizer-path Qwen/Qwen2.5-0.5B-Instruct \
--url http://127.0.0.1:8801/v1/chat/completions \
--api openai \
--dataset random \
--max-tokens 1024 \
--prefix-length 0 \
--min-prompt-length 1024 \
--max-prompt-length 1024 \
--sla-auto-tune \
--sla-variable parallel \
--sla-params '[{"tps": "max"}]' \
--parallel 4
Example output:
Performance Overview
βββββββββ³βββββββ³βββββββ³βββββββ³ββββββββββ³ββββββββββ
β Conc. β Rate β Num β RPS β Gen/s β Success β
β‘βββββββββββββββββββββββββββββββββββββββββββββββββ©
β 32 β - β ... β 5.68 β 5813.67 β 100.0% β
β 64 β - β ... β 5.76 β 5902.57 β 100.0% β
β 128 β - β ... β 6.96 β 7124.25 β 100.0% β
β 256 β - β ... β 7.81 β 8000.89 β 100.0% β
β 384 β - β ... β 7.87 β 8057.14 β 100.0% β
β ... β - β ... β ... β ... β 100.0% β
β 512 β - β ... β 7.76 β 7941.28 β 100.0% β
βββββββββ΄βββββββ΄βββββββ΄βββββββ΄ββββββββββ΄ββββββββββ
2025-12-18 15:06:49 - evalscope - INFO: SLA Auto-tune Summary:
+------------+------------+-----------------+---------------------+
| Criteria | Variable | Max Satisfied | Note |
+============+============+=================+=====================+
| tps -> max | parallel | 384 | Best tps: 8057.1438 |
+------------+------------+-----------------+---------------------+
3. Find Maximum Request Rate Meeting TTFT < 0.05s and TTFT < 0.01s in Specific Range#
evalscope perf \
--model Qwen2.5-0.5B-Instruct \
--tokenizer-path Qwen/Qwen2.5-0.5B-Instruct \
--url http://127.0.0.1:8801/v1/chat/completions \
--api openai \
--dataset random \
--max-tokens 512 \
--prefix-length 0 \
--min-prompt-length 512 \
--max-prompt-length 512 \
--sla-auto-tune \
--sla-variable rate \
--sla-params '[{"p99_ttft": "<0.05"}, {"p99_ttft": "<0.01"}]' \
--rate 2 \
--sla-num-runs 1 \
--sla-fixed-parallel 40 \
--sla-lower-bound 10 \
--sla-upper-bound 40
Example output:
Performance Overview
ββββββββ³βββββββ³ββββββ³ββββββββ³ββββββββββ³ββββββββββ
βConc. β Rate β Num β RPS β Gen/s β Success β
β‘ββββββββββββββββββββββββββββββββββββββββββββββββ©
β 40 β 10 β ... β 5.16 β 948.33 β 100.0% β
β 40 β 15 β ... β 9.78 β 2249.29 β 100.0% β
β 40 β 17 β ... β 8.17 β 1530.79 β 100.0% β
β 40 β 18 β ... β 10.30 β 2466.09 β 100.0% β
β 40 β 19 β ... β 12.83 β 2296.22 β 100.0% β
β 40 β 20 β ... β 11.81 β 2435.94 β 100.0% β
ββββββββ΄βββββββ΄ββββββ΄ββββββββ΄ββββββββββ΄ββββββββββ
2025-12-18 16:19:48 - evalscope - INFO: SLA Auto-tune Summary:
+-----------------+------------+-----------------+----------------------------+
| Criteria | Variable | Max Satisfied | Note |
+=================+============+=================+============================+
| p99_ttft < 0.05 | rate | 19 | Satisfied |
+-----------------+------------+-----------------+----------------------------+
| p99_ttft < 0.01 | rate | None | Failed at lower bound (10) |
+-----------------+------------+-----------------+----------------------------+