ASP.NET Core MVC Interview Question #185
How would you diagnose a slow MVC page in production?
Senior Practical MVC Scenarios & Production Architecture Senior Advanced
Quick Interview Answer
Measure the complete request path rather than guessing. Review request latency, application logs, traces, database query timings and execution plans, external HTTP calls, cache behavior, allocations, and browser network timing.
Detailed Explanation
Measure the complete request path rather than guessing. Review request latency, application logs, traces, database query timings and execution plans, external HTTP calls, cache behavior, allocations, and browser network timing.
Use a correlation or trace identifier so related events can be connected. Optimize the measured bottleneck, then measure again to verify that the change improved the real workload.
Code Example
using (_logger.BeginScope(
new Dictionary<string, object>
{
["Page"] = "ProductSearch"
}))
{
var model = await _service.SearchAsync(query, token);
return View(model);
}