A STAR story for a post-release latency regression: detection, deployment-marker correlation, rollback versus forward fix, root cause in code or query, and release guardrails.
I tell it as detect → mitigate → diagnose → fix → prevent. The p95 alert fired [N] minutes after a release; the deployment marker in Application Insights lined up exactly, so I rolled back first (slot swap back, [X] minutes) instead of debugging live. Then I used the dependency breakdown to see where the extra time went: own code, SQL or a downstream call. In my case it was [an EF Core query whose plan changed / an N+1 / a sync call]. I proved it with [Query Store / dotnet-trace], fixed it, and added a latency gate on canary traffic plus [a query-count test]. Result: p95 back from [X] to [Y] ms. The trade-off I mention: rolling back fast costs you the live evidence, so capture a trace or dump before you roll back if it takes under five minutes.
"At [company] we ran [the orders API], about [N] requests per second with a p95 SLO of [300 ms]. Twenty minutes after a Tuesday release the burn-rate alert fired: p95 had gone from [250] to [520] ms with no errors. The deployment marker in Application Insights sat exactly on the step change, so my first decision was to mitigate, not investigate. I grabbed a 60-second dotnet-trace from one instance, then swapped the staging slot back. p95 recovered within [four] minutes.
With the pressure off, I compared the old and new versions in Application Insights. The dependency view showed SQL time per request had tripled, while our own code time was flat. Query Store showed one query, the order-summary lookup, with a new plan: a refactor had moved a filter after a
ToList(), so EF Core was pulling [40,000] rows and filtering in memory. I moved the filter back into the IQueryable, checked the generated SQL withToQueryString(), and re-released behind a feature flag to [10%] of traffic first.The bigger change was the guardrail. I added an integration test that asserts the SQL command count and row count for that endpoint, and we added an automatic canary gate: if canary p95 is more than [20%] above baseline for ten minutes, the pipeline stops. In the next [six] months it caught [two] regressions before customers saw them. What I learnt is that latency regressions are a release-process problem as much as a code problem."
| Step | What you say | Evidence that makes it senior |
|---|---|---|
| Detect | Which alert, which percentile | p95/p99 SLO burn rate, not average or CPU |
| Correlate | What changed | Deployment marker, config change, traffic mix, data growth |
| Mitigate | Rollback, flag off, scale out | Minutes to mitigate; evidence captured first |
| Diagnose | Where the time went | Dependency breakdown, Query Store, dotnet-trace flame graph |
| Fix | Root cause, not symptom | Diff of the change; generated SQL; benchmark |
| Prevent | Why it won't recur | Test, canary gate, analyser, checklist |
| Cause | Signal | Tool that proves it |
|---|---|---|
EF Core query change (client evaluation, N+1, missing AsNoTracking) |
SQL dependency time up, command count up | Application Insights dependencies, ToQueryString(), Query Store |
| New synchronous or blocking call | Thread count climbing, ThreadPool queue length up | dotnet-counters (threadpool-queue-length) |
| New downstream HTTP call in the hot path | New dependency appears in the end-to-end trace | Transaction search, Application map |
| Allocation-heavy code | Gen 0/1 GC rate and % time in GC up |
dotnet-counters, dotnet-trace GC events |
| Config change (lower pool size, log level Debug) | Specific to one setting | Diff of app settings; release notes |
| Cache key change causing misses | Cache hit ratio drops, DB load up | Custom metric, Redis INFO stats |
Rolling back is the default, but not when the release contained a non-reversible schema migration, or when the regression is minor and the release fixes a security issue. Then you mitigate forward: scale out, disable the feature flag, or hotfix.
The template: p95 on [the orders API] went from [250] to [520] ms after release [x.y]; rolled back in [4] minutes; root cause was [in-memory filtering after ToList(), 40,000 rows per call]; fix cut SQL time per request from [180] to [12] ms; the canary gate later caught [2] more regressions before full rollout.
Checks whether you handle a production regression with calm, evidence-based judgement and leave the system better, and whether you can tell it clearly with your own contribution and a measured result.
Green flags
Red flags
A latency-regression story tests four things at once: operational judgement (do you mitigate before you investigate), diagnostic method (do you narrow with data or guess), technical depth (can you name the mechanism that made it slow) and ownership after the fix (did the system get better, or did you just patch it). The question is asked to almost every senior .NET candidate because nearly everyone has lived through one, so a vague answer stands out.
Alert: p95 up 2x
|
v
What changed? -- deployment marker / config / traffic / data growth
|
v
Where is the time? -- Application Insights: server time = own code + dependencies
| \
v v
Own code Dependency (SQL / HTTP / Redis)
dotnet-counters Query Store, plan diff,
dotnet-trace dependency duration by target
| |
v v
Root cause --> fix --> test that would have failed --> release guardrail
The key move is splitting server time into own code and dependencies. Application Insights records each SQL and HTTP call as a dependency, so a query in KQL that sums dependency duration per request, before and after the release, tells you in two minutes which half to look at.
requests
| where timestamp > ago(6h) and name == "GET /orders/{id}"
| summarize p95 = percentile(duration, 95) by bin(timestamp, 5m), application_Version
A regression that affects 10% of requests (for example, only large customers with many orders) barely moves the average but doubles p95 or p99. That is why the story should name the percentile and the SLO. If you say "the average went up a bit", the interviewer hears that you weren't watching the right number.
Rollback destroys the live state. If you can capture evidence in under five minutes, do it first: a 30–60 second dotnet-trace collect --profile cpu-sampling, or a snapshot from the Application Insights Profiler. Then roll back. Saying this out loud is a strong senior signal, because it shows you balance customer impact against learning.
Interviewers commonly score on a 1–4 scale per competency: 1 = vague or team-only ("we fixed it"); 2 = clear actions but no evidence; 3 = clear personal actions, evidence, a number; 4 = all of that plus a systemic change and a reflection. Most candidates stop at the fix; the guardrail and the reflection move you to a 4.
The same incident answers: "Tell me about a production incident", "a time you used data to make a decision", "a time you improved a process" (lead with the canary gate), and "a time you made a mistake" (if the regression was your change). Prepare one paragraph per angle.
dotnet-counters monitor -p <pid> --counters System.Runtime while load-testing a debug build and note the ThreadPool queue length and GC rate at baseline.dotnet-trace and open it in PerfView or Visual Studio to find the hottest method.The key fix in this example: a filter moved after materialisation, and the test that now guards it.
namespace Orders.Api.Queries;
public sealed record OrderSummary(int Id, string Status, decimal Total);
public sealed class OrderSummaryQuery(OrdersDbContext db)
{
// Before (the regression): ToListAsync() ran first, so EF Core pulled every row
// for the customer and the Status filter ran in memory.
// var all = await db.Orders.Where(o => o.CustomerId == customerId).ToListAsync(ct);
// return all.Where(o => o.Status != "Archived").Select(...).ToList();
// After: the whole filter and projection stay in the IQueryable, so SQL does the work.
public Task<List<OrderSummary>> GetAsync(int customerId, CancellationToken ct) =>
db.Orders
.AsNoTracking()
.Where(o => o.CustomerId == customerId && o.Status != "Archived")
.OrderByDescending(o => o.CreatedAt)
.Take(50)
.Select(o => new OrderSummary(o.Id, o.Status, o.Total))
.ToListAsync(ct);
}
STAR template (fill in your own details)
S: At [company], [service] handled [N req/s] with a p95 SLO of [X ms].
T: After release [version], p95 doubled to [Y ms]; I was [on call / the release owner].
A: I [captured a trace], [rolled back in N min], used [App Insights dependencies / Query Store]
to find [root cause], fixed it by [change], and added [test + canary gate].
R: p95 back to [X ms]; mitigation in [N min]; gate caught [N] regressions in [period].
Illustrative only (not a real history):
S: Orders API, 400 req/s, p95 SLO 300 ms. T: p95 hit 520 ms after a release; I was on call.
A: Trace, slot swap back in 4 min, Query Store showed a new plan pulling 40k rows; moved the filter into SQL.
R: SQL time per request 180 ms -> 12 ms; canary gate caught 2 later regressions.
What makes this sound senior is scope and system thinking: you protected customers first, you used evidence to narrow the cause, and you changed the release process so the class of problem is caught automatically. Mention the trade-off you made (rollback lost evidence, so you took a trace first) and what it cost. If you can quantify the guardrail's value later ("caught two regressions in six months"), that is the strongest line in the answer.
Proactive monitoring is the other half. Seniors don't wait for a customer to complain: they have SLO burn-rate alerts on p95/p99, telemetry tagged by application version so the comparison is instant, and dashboards that show dependency time per request. In the cloud, a latency regression is also a cost event: more instances autoscale in, Azure SQL DTU or vCore usage climbs, and the bill moves. Mention that you watched (or added an alert on) database utilisation and autoscale count, because it shows you think about the platform, not just the code.
| Mitigation | When it fits | Cost | When not to |
|---|---|---|---|
| Roll back / slot swap | Stateless change, quick to revert | Lose live evidence; feature delayed | Irreversible migration or changed contract in the release |
| Feature flag off | Change was flagged | Needs flag discipline in advance | Change wasn't behind a flag |
| Scale out | Load-related, buys time | Money every hour; may hide the cause | Bottleneck is the database |
| Hotfix forward | Rollback impossible, cause obvious | Risk of a second bad release | Cause not yet proven |
| Guardrail | Catches | Effort |
|---|---|---|
| Canary with latency gate | Most regressions under real traffic | Medium (pipeline + metrics) |
| Version-tagged SLO dashboards and burn-rate alerts | Regressions within minutes of rollout | Low once telemetry is tagged |
| Query-count / SQL snapshot tests | EF Core query regressions | Low |
| BenchmarkDotNet in CI | Hot-path CPU/allocation regressions | Medium; noisy without dedicated agents |
First I confirm it's the release: Application Insights with the deployment annotation, comparing p95 by operation before and after. Then I check where the time goes: in the slow operation, are SQL dependencies longer (a worse query) or more numerous (N+1)? Next, Query Store on Azure SQL: Regressed Queries and Top Resource Consuming Queries show which statement got worse and whether its plan changed. I map that SQL back to code with TagWith comments (or the text), then read the LINQ diff: typical culprits are a non-sargable predicate, a new collection Include, a lost projection, or a parameter type change. I mitigate first: roll back or flag the change off; force the old plan only if it's purely a plan regression. Then fix the LINQ, verify the plan, and add query tags, a perf test and Query Store alerts. The trade-off: rollback is fastest, but only the root cause stops it recurring.
I split the request into time in my code and time in dependencies. In Application Insights, the end-to-end transaction view and a KQL query comparing request duration with the sum of its dependency durations tell me quickly: if one dependency's p95 jumped at 10 am, it's them; if dependencies are normal but requests are slow, the time is in my process. A gap before a dependency call starts means queueing inside my service: ThreadPool starvation, an exhausted connection pool or a rate limiter. dotnet-counters confirms CPU, GC and queue lengths. For a slow dependency I contain it with per-attempt timeouts, a circuit breaker, a bulkhead and a fallback; for my own code I roll back or scale while I fix it. The trade-off: aggressive timeouts protect you but turn slowness into errors, so they need fallbacks.
Ship the new version alongside the old and send it a small share of traffic (5–10%) using App Service deployment slot traffic routing, Container Apps revision weights or gateway weights (Front Door, APIM, YARP). Tag telemetry with the version (application_Version / service.version) so Application Insights can compare canary and stable p95 and error rate over the same window. A pipeline stage (Azure DevOps gate or a GitHub Actions job running a KQL query, or an Azure Monitor alert) waits [10–30 minutes]; if canary p95 is more than [20%] above stable or errors exceed the SLO, it sets the weight back to 0 automatically, otherwise it steps up (10% → 50% → 100%). Keep risky features behind feature flags (Azure App Configuration) so you can turn one off without redeploying. Size the canary so it gets enough requests for a meaningful comparison.
How to tell it (STAR)
**S:** At [company] I worked on [the orders API], about [400] requests a second with a 300 ms p95 SLO. **T:** Twenty minutes after a release I was [on call] when p95 doubled to [520] ms, mostly hurting our [largest customers]. **A:** I took a quick trace, then swapped the slot back so customers recovered in [four] minutes. Using Application Insights I saw SQL time per request had tripled while our code was flat, and Query Store pointed at one query: a refactor had moved a filter after `ToList()`, so we were pulling [40,000] rows per call. I fixed it, re-released to [10%] of traffic first, and added a SQL-count test and an automatic canary latency gate. **R:** SQL time per request dropped from [180] to [12] ms, and over the next [six] months the gate stopped [two] regressions before customers saw them.
Last updated 23 Nov 2026.