Load, stress, soak and spike tests as distinct test types: the question each answers, workload shapes, tool choice (k6, Azure Load Testing, NBomber and its licence), pass/fail criteria and what to read in the results for a .NET 10 API.
They are all performance tests with different workload shapes, each answering a different question. A load test runs expected peak traffic and asks "do we meet our SLO?", for example p95 under 300 ms and errors under 0.1%. A stress test ramps past peak until something breaks and asks "where is the limit, and do we degrade and recover gracefully?". A soak test holds normal load for hours to find leaks: memory, connections, handles, disk. A spike test jumps traffic suddenly to test autoscaling and cold starts. Tools: k6 or Azure Load Testing (JMeter or Locust scripts, managed, CI gates), or NBomber in C# (paid for organisational use). Read percentiles and error rates alongside server metrics. The trade-off: realistic tests need a production-like environment and data, which costs money.
"They're all performance tests; what changes is the shape of the traffic and the question. A load test runs the traffic we expect at peak, say 800 requests per second with a realistic mix of endpoints, and asks whether we meet the SLO: p95 under 300 ms, p99 under a second, errors under 0.1%. A stress test keeps ramping beyond that until something gives, and asks where the limit is, what breaks first and whether the service sheds load cleanly with 429s or 503s and recovers when traffic drops, rather than falling over. A soak test holds normal load for four to twelve hours. It finds the slow problems: memory that creeps up until the container is OOM-killed, a connection pool that leaks, a cache with no size limit. A spike test goes from 50 to 2,000 requests per second in seconds and checks autoscaling, cold starts and queues.
For tools, I'd normally write k6 scripts because they're easy to keep in the repo, and run them at scale through Azure Load Testing, which can also run JMeter or Locust scripts, fail a pipeline on thresholds and show server-side Azure Monitor metrics next to client results. NBomber is nice when a team wants scenarios in C#, but its licence requires a paid subscription for organisational use, so that's a conversation before adopting it.
The mistake I see is reading averages. An average of 120 ms can hide a p99 of 4 seconds. I look at percentiles over time, error rate, throughput, and on the server side CPU, GC pause time and ThreadPool queue length from dotnet-counters, plus SQL CPU and waits. A test only means something if the pass criteria were written down before it ran."
load stress soak spike
rps rps rps rps
| ____ | /| | _______________ | __
| / \ | / | | / \ | | |
|/ \ | / | |/ \ |___| |___
+--------> +--------> +-------------------> +----------->
30-60 min until failure 4-12 hours minutes
| Type | Question | Typical failure it finds |
|---|---|---|
| Load | Do we meet the SLO at expected peak? | Slow queries, missing indexes, chatty calls |
| Stress | Where is the limit, how do we fail and recover? | ThreadPool starvation, pool exhaustion, cascading timeouts |
| Soak | Is it stable over time? | Memory leaks, unbounded caches, handle or disk growth |
| Spike | Can we absorb a sudden jump? | Slow autoscale, cold starts, queue backlogs |
| Tool | Scripts in | Strengths | Watch out for |
|---|---|---|---|
| k6 (Grafana) | JavaScript/TypeScript | Open source, thresholds, easy in CI | Single machine limits without a cloud runner |
| Azure Load Testing | JMeter or Locust (GA since 2025) | Managed scale, multi-region, Azure Monitor metrics side by side, CI fail criteria | Pay per virtual user hour |
| NBomber | C# | Same language as the app | Free only for personal use; organisations need a commercial licence |
| JMeter | XML/GUI | Mature, protocol-rich | Heavy, awkward to review in PRs |
dotnet-counters monitor System.Runtime), ThreadPool queue length, Kestrel connection counts, HTTP client pool, SQL CPU, waits and Query Store top queries, Redis latency.Before an end-of-financial-year peak, a stress test on a payments API showed p95 jumping from 180 ms to 6 s at 1,100 rps. dotnet-counters showed the ThreadPool queue climbing: a synchronous .Result call on an HTTP client. After fixing it, the knee moved to 2,400 rps, and a 6-hour soak test then found a 40 MB/hour leak from an unbounded MemoryCache, fixed with a SizeLimit before go-live.
Checks whether the candidate knows the distinct purposes of performance test types and can read results like an engineer, not a tool operator.
Green flags
Red flags
constant-arrival-rate and ramping-arrival-rate executors do this.Use open models for public APIs. Closed models understate latency under overload; this is related to coordinated omission, where the load generator stops sending while waiting, so the slowest periods are under-sampled.
concurrency = throughput x latency
800 rps x 0.25 s = 200 requests in flight
If latency doubles at the same throughput, in-flight requests double, which is what exhausts connection pools and ThreadPool threads during a stress test.
traffic rises
-> SQL CPU or locking saturates -> queries queue
-> DbContext connections held longer -> pool (default max 100) exhausted
-> requests wait for connections -> latency climbs
-> sync-over-async code blocks ThreadPool threads -> starvation
-> timeouts and retries add more load -> cascading failure
A good stress test shows which link fails first, so you know what to fix or protect with rate limiting and timeouts.
Soak tests find problems with a rate, not a threshold: memory growing 30 MB/hour, a socket leak from creating HttpClient per request, log files filling a disk, Gen 2 heap growth from an event handler never unsubscribed. Plot memory and handle counts over the whole run; a sawtooth is healthy, a ramp is a leak.
ramping-arrival-rate executor and thresholds on http_req_duration p95 and http_req_failed.dotnet-counters monitor -n MyApi System.Runtime.Thread.Sleep(50) to an endpoint and watch ThreadPool queue length during a stress ramp.A k6 script with load and stress stages and pass/fail thresholds, plus an Azure Load Testing config that fails the pipeline:
// load-test.js
import http from 'k6/http';
import { check } from 'k6';
export const options = {
scenarios: {
orders: {
executor: 'ramping-arrival-rate', // open model: fixed arrival rate
startRate: 50,
timeUnit: '1s',
preAllocatedVUs: 200,
maxVUs: 2000,
stages: [
{ target: 800, duration: '5m' }, // ramp to expected peak (load)
{ target: 800, duration: '20m' }, // hold peak
{ target: 2400, duration: '10m' }, // keep going (stress)
{ target: 0, duration: '5m' }, // recovery
],
},
},
thresholds: {
http_req_duration: ['p(95)<300', 'p(99)<1000'],
http_req_failed: ['rate<0.001'],
},
};
export default function () {
const res = http.get(`${__ENV.BASE_URL}/orders?page=1`);
check(res, { 'status 200': (r) => r.status === 200 });
}
# Azure Load Testing test config (load-test.yaml)
version: v0.1
testId: orders-peak
testType: Locust # or JMX for JMeter
testPlan: locustfile.py
engineInstances: 4
failureCriteria:
- p95(response_time_ms) > 300
- percentage(error) > 0.1
A small C# endpoint guard that makes stress tests fail gracefully instead of collapsing:
namespace Orders.Api;
using System.Threading.RateLimiting;
public static class LoadSheddingSetup
{
public static IServiceCollection AddLoadShedding(this IServiceCollection services) =>
services.AddRateLimiter(o =>
{
o.RejectionStatusCode = StatusCodes.Status503ServiceUnavailable;
// Cap concurrent work so overload returns fast 503s, not 30 s timeouts.
o.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(_ =>
RateLimitPartition.GetConcurrencyLimiter("global", _ => new ConcurrencyLimiterOptions
{
PermitLimit = 400,
QueueLimit = 200,
QueueProcessingOrder = QueueProcessingOrder.OldestFirst
}));
});
}
The four test types answer four different questions, and picking the wrong one wastes the run. Before a seasonal peak I'd do a load test to confirm SLOs, a stress test to find the knee and confirm we shed load cleanly and recover (time from load dropping to p95 back under SLO is a metric in its own right), and a soak test before any release that touched caching, connections or background work. Spike tests matter most when autoscaling or serverless is involved, because scale-out takes minutes while spikes take seconds.
What makes it senior is the loop and the baseline. Keep a recorded baseline per release (throughput at the knee, p95 at peak, memory per replica) so a regression shows up as a diff, not a feeling, and run a reduced load test nightly against the same baseline. After go-live, the same SLO thresholds become Application Insights and Azure Monitor alerts, so production keeps testing the assumptions the load test made. And protect the service from the stress case in production with rate limiting, timeouts and bulkheads, so the stress test result is "returns 503s quickly and recovers in a minute" rather than "falls over".
| Approach | When it fits | Cost | When not to |
|---|---|---|---|
| k6 locally or in CI | Fast feedback, small scale | Free | Need thousands of rps from many regions |
| Azure Load Testing | Scale, Azure metrics, CI gates | Per virtual-user hour | Very small services where k6 on one agent is enough |
| NBomber | Team wants C# scenarios | Commercial licence for organisations | Budget or licence approval is a blocker |
| Nightly reduced load test vs baseline | Catching gradual performance regressions | CI minutes plus an environment | Services with no latency SLO |
A useful load test answers a specific question: can we handle peak, where do we break, or do we degrade over hours. So I choose the test type (load, stress, soak or spike) and model the real workload: the endpoint mix, data volumes, auth and cache hit rates, in a production-like environment.
I use an open model (a target arrival rate, like k6's constant-arrival-rate) because a closed model with a fixed number of virtual users slows down when the server does, which causes coordinated omission and hides the tail.
I report p50, p95 and p99 and error rate, never averages, and read them next to server-side metrics to see which resource saturates first. The trade-off: realistic tests cost environment and data effort, but unrealistic ones give confident wrong answers.
The .NET diagnostics tools all talk to the runtime over its diagnostics IPC channel, so they work on Windows, Linux and in containers without a debugger.
I start with counters because they are cheap, then pick the heavier tool the symptom points to. The trade-off is overhead and data sensitivity: a full dump contains every secret in memory.
First I confirm it is managed memory: in dotnet-counters, if gc-heap-size grows with the working set and survives Gen 2 collections, it's a managed leak; if the working set grows but the heap doesn't, it's native, and I switch to dotnet-dump (eeheap, maddress) and native tools.
For managed growth I take two or three dotnet-gcdump snapshots under the same load, minutes apart, and compare them in Visual Studio or PerfView. The type whose count and size keep rising is the suspect, and its paths to root show what holds it: usually a static cache, an event subscription, a timer, or services resolved from the root DI scope. If the heap grows but object counts don't, I check LOH fragmentation from long-lived large buffers.
I fix the root, not the symptom, and verify with a soak test that the heap flattens. The trade-off: each gcdump forces a full blocking GC, so I take few snapshots and avoid peak traffic when I can.
How to tell it (STAR)
**S:** We were [a week] from go-live for a [ticketing] API and our load and stress tests had passed comfortably. **T:** I argued we still needed a soak test, because nothing we'd run lasted more than 40 minutes. **A:** I ran a 6-hour soak at 60% of peak in Azure Load Testing while watching dotnet-counters. Memory climbed steadily until the container was OOM-killed at hour five. Two gcdump snapshots showed an unbounded MemoryCache. I added a size limit and absolute expiry and reran the soak. **R:** Memory flattened at about 520 MB instead of hitting 1.4 GB, the on-sale ran at [peak rps] with no restarts, and soak tests became a standard pre-release step.
Last updated 23 Nov 2026.