Automation
Azure Load Testing: validate a release gate before automating rollback
A production runbook for separating load-test validity, client failures, server saturation and deployment regression before promoting, holding or rolling back a release.
A release candidate passes functional tests, then Azure Load Testing reports a failed run. The pipeline can stop safely. The harder question is whether it should also roll production back automatically.
A failed load test is not yet a rollback decision. The generator may have lost connectivity, the scenario may have changed, test data may be exhausted, or one non-critical sampler may dominate the aggregate. Conversely, a run can pass its client thresholds while a dependency saturates and leaves no operating margin.
The running case is an API release tested at a controlled request rate before full promotion. This runbook turns the test into an evidence-based gate: promote, hold for investigation, retry an invalid run, or roll back the release.
Freeze the release decision contract
Before reading charts, bind the run to one immutable release and one expected traffic envelope. A dashboard without this contract cannot prove what was tested.
release:
id: orders-api-2026.10.27-3
image_digest: sha256:<digest>
environment: preprod
production_baseline: orders-api-2026.10.26-2
load_profile:
test_id: orders-api-release-gate
scenario_version: 12
dataset_hash: <sha256>
engine_instances: 2
duration_minutes: 15
target_rps: 300
warmup_minutes: 3
decision:
promote_when: client criteria pass and server margin is positive
retry_when: run validity is not proven
rollback_when: release regression is reproduced and user impact is bounded
approver: platform-oncall Record the pipeline run, commit, image digest, test configuration, test plan, input-data hash, target hostname and deployment time. Do not compare a candidate tested through a private path with a baseline tested through a public edge, or a cold deployment with a warmed baseline, without naming that difference.
Prove that the run is valid
Validate the test before validating the application. The first branch separates an invalid run from a valid negative result.
Check that the run reached its intended duration and load, all engines started, the target was the expected revision, authentication succeeded, test data remained usable and no global network or DNS error appeared before application traffic. A stopped run does not evaluate the same contract as a completed run.
RUN IS VALID WHEN
deployed digest matches the release contract
scenario and dataset hashes match the pipeline artifact
achieved load stays inside the agreed tolerance
warm-up completes before the decision window
generator errors are absent or explained
request mix matches the production hypothesis
RUN IS INVALID WHEN
engines fail to start or lose the target path
credentials expire during the test
test data creates artificial conflicts or 404s
the target changes during the run
achieved load never reaches the decision envelope Retry only invalid runs, after correcting the validity fault. Retrying a valid failed run until it passes turns the gate into sampling bias.
Keep auto-stop and failure criteria separate
Auto-stop protects the target and the test budget when errors become extreme. Failure criteria express the quality contract at the end of a valid run. They should not carry the same threshold.
version: v0.1
testId: orders-api-release-gate
displayName: Orders API release gate
testPlan: orders-api.jmx
testType: JMX
engineInstances: 2
failureCriteria:
- percentage(error) > 2
- p95(response_time_ms) > 800
- CreateOrder: percentage(error) > 1
- CreateOrder: p95(response_time_ms) > 1000
autoStop:
errorPercentage: 20
timeWindow: 60 The values are examples, not universal SLOs. Derive them from the user journey, normal variance and available capacity. Prefer percentile and error criteria on critical requests over one average for the whole script. A fast health endpoint must not hide a slow write path, and one optional report must not block every release without an explicit business reason.
Version the criteria with the scenario. A threshold edit is a production control change: review it independently from the release being measured.
Separate client symptoms from server saturation
Client metrics describe what the load generator observed: latency, throughput and errors. They do not identify the saturated component. Attach the Azure resources that implement the tested path and collect server-side metrics over the same window.
For the API path, inspect at least application request duration and failures, replica or instance saturation, dependency latency and errors, throttling, queue depth or connection pressure where relevant. Keep one capacity signal and one functional signal for every critical dependency.
Use this reading order:
- Confirm that achieved throughput matches the requested load.
- Split errors by request or sampler, status and time window.
- Find the first server-side signal that changes before client latency rises.
- Compare the same signal with a known-good baseline.
- Check whether the change started with the candidate deployment or with the test itself.
A client timeout with no server request can indicate DNS, TLS, routing, authentication or generator exhaustion. A server 429 with stable application latency points to an explicit capacity boundary. A rising dependency duration before API latency identifies a different rollback owner than CPU saturation in the new revision.
Correlate the run with deployment telemetry
Use a release identifier or test-run correlation value that reaches application telemetry without changing business behavior. Query the exact decision window and keep warm-up separate from steady state.
let start = datetime(2026-10-27T06:10:00Z);
let steady = datetime(2026-10-27T06:13:00Z);
let stop = datetime(2026-10-27T06:25:00Z);
AppRequests
| where TimeGenerated between (start .. stop)
| extend ReleaseId = tostring(Properties["release_id"])
| where ReleaseId == "orders-api-2026.10.27-3"
| extend Phase = iff(TimeGenerated < steady, "warmup", "steady")
| summarize
Requests = count(),
Errors = countif(Success == false),
P50 = percentile(DurationMs, 50),
P95 = percentile(DurationMs, 95),
P99 = percentile(DurationMs, 99)
by Phase, OperationName, bin(TimeGenerated, 1m)
| order by TimeGenerated asc Adapt table and property names to the deployed telemetry schema. Preserve the query with the release evidence. If the correlation property is missing, do not silently widen the query to all traffic: record that the candidate cannot be isolated and downgrade automatic rollback to a hold.
Compare with a trustworthy baseline
Azure Load Testing can compare completed runs and mark a run as a baseline. The baseline is useful only when the scenario, route, dataset class, load profile and application topology remain comparable.
Compare more than one number. Review response-time percentiles, error percentage, achieved throughput and the server-side signals that explain remaining headroom. A candidate that improves average latency but doubles p99 on the write path is not equivalent. A baseline from a quiet environment with fewer engines or another region is context, not a release gate.
Keep two references when possible: the last promoted release under the same gate and a recent repeated run of that release. Their spread reveals normal variance. Set thresholds outside expected noise but inside the point where the user journey or capacity margin becomes unacceptable.
Canary the gate before it can roll back
Introduce automation in stages.
STAGE 1 - OBSERVE
Run the test and publish evidence; never block or roll back.
STAGE 2 - BLOCK PROMOTION
A valid failed run stops the release; an operator chooses retry or rollback.
STAGE 3 - RECOMMEND ROLLBACK
The pipeline prepares the exact previous artifact and evidence pack.
STAGE 4 - AUTOMATE BOUNDED ROLLBACK
Only a reproduced release regression can restore the pinned previous artifact.
Missing evidence, invalid runs and platform incidents remain manual holds. Test the gate with deliberate failures: a known slow endpoint, expired test credential, unreachable target, exhausted dataset and a server metric that approaches its limit. The expected result is not always rollback. The gate must distinguish invalid test, application regression, capacity limit and platform fault.
Decide, validate or roll back
Promote when the run is valid, critical client criteria pass, server-side metrics retain the agreed margin, and the candidate remains comparable to the baseline.
Hold when the run is valid but causality is unclear, correlation is missing, only a non-critical sampler fails, or the baseline is not comparable. Preserve the release and test resources long enough to investigate.
Retry when the run is invalid because the generator, credentials, route or dataset broke. Correct that fault, keep the same release artifact, then execute one traceable retry.
Roll back when a valid run reproduces a material regression on the candidate, the previous artifact is pinned and deployable, and rollback risk is lower than promotion risk. Restore the exact previous image or deployment version; do not combine rollback with a threshold edit, scale change or infrastructure rewrite.
After rollback, rerun a short canary with the same scenario and confirm both client recovery and server margin. If the previous release fails the same way, stop calling the incident a release regression and investigate the shared platform, dependency or test contract.
Conclusion
An Azure Load Testing failure is an input to a release decision, not the decision itself. A reliable gate proves run validity, compares like with like, joins client symptoms with server evidence and names the exact artifact it can restore.
Automation should first observe, then block, then recommend, and only then perform a bounded rollback. The final state is explicit: promote, hold, retry the test or restore the pinned release, with enough evidence to explain why.