Making .NET 10 services fast and efficient across the stack: CPU, memory and async performance, caching strategies, profiling tools, API performance, and end-to-end EF Core and SQL tuning, always driven by measurement.
-
How do you write a correct benchmark with BenchmarkDotNet? Show a benchmark that compares two implementations, and explain [MemoryDiagnoser], baselines, [Params], and how you avoid dead-code elimination and other traps that make results meaningless.
Writing trustworthy micro-benchmarks with BenchmarkDotNet on .NET 10: Release builds, warm-up and statistics, MemoryDiagnoser, baselines and ratios, Params, returning results to defeat dead-code elimination, and reading the results table.
Intermediate
Coding
Profiling
Β· π 2 follow-ups
-
How do you CPU-profile a .NET service with dotnet-trace? Explain how sampling works, how you read a flame graph or call tree in PerfView, Speedscope or Visual Studio, the difference between inclusive and exclusive time, and how you go from a hot frame to a fix.
CPU profiling .NET 10 services: EventPipe stack sampling with dotnet-trace, flame graphs and call trees in PerfView, Speedscope and Visual Studio, inclusive vs exclusive time, wall-clock vs CPU time, and turning a hot path into a verified fix.
Mid-Level
Theory
Profiling
Β· π 3 follow-ups Β· π 1 real-world
-
Your API's memory grows steadily for hours until the container is OOM-killed and restarted. How do you use dotnet-counters and dotnet-gcdump snapshots to find what is growing and what keeps it alive, and how do you fix and verify it?
Diagnosing managed memory growth in .NET 10: confirming it with GC counters, comparing dotnet-gcdump snapshots in Visual Studio or PerfView, reading retention paths to the GC root, common leak roots (static caches, events, DI scopes, timers), and verifying the fix.
Mid-Level
Debugging
Profiling
Β· π 3 follow-ups Β· π 1 real-world
-
How do you profile a .NET service safely in production? Explain how you would use dotnet-monitor in containers and the Application Insights Profiler, what overhead each adds, and how you handle the security and privacy risks of traces and dumps.
Production profiling for .NET 10: dotnet-monitor as a sidecar with collection rules and egress, the Application Insights Profiler (classic SDK and the OpenTelemetry preview), overhead and blast radius, authentication, and Privacy Act obligations for diagnostic artefacts.
Senior
Theory
Profiling
Β· π 3 follow-ups Β· π 1 real-world
-
How do you load test a .NET API properly? Explain how you design a realistic workload with k6 or Azure Load Testing, open vs closed load models and coordinated omission, how you read percentiles, and how you find the breaking point.
Load testing ASP.NET Core APIs: test types (smoke, load, stress, soak, spike), realistic workload modelling, open vs closed models and coordinated omission, k6 and Azure Load Testing, reading p50/p95/p99 and finding the saturation point with server-side metrics.
Mid-Level
Theory
Profiling
Β· π 2 follow-ups Β· π 1 real-world
-
One endpoint is slow only in production: p95 is 3 seconds there but 150 ms in staging and locally, and you can't reproduce it. What is your plan to find out why, which tools do you use at each step, and how do you prove the fix?
A production-only slow endpoint with no repro: listing what differs in production (data, concurrency, configuration, dependencies, tenants), slicing telemetry to isolate the slow subset, then targeted evidence from distributed traces, Query Store, the Application Insights Profiler and dotnet-monitor triggers, and proving the fix with production percentiles.
Senior
RealWorldScenario
Profiling
Β· π 3 follow-ups Β· π 1 real-world
-
Why does response size matter so much for API latency? Explain how pagination, projection and compression shrink a response, why payload size hurts most on mobile networks, and how you would measure the gain.
Covers how payload size drives API latency, and reducing it with pagination, projection (purpose-built DTOs), compression and omitting nulls, with measurement on real networks.
Intermediate
Theory
API Performance
Β· π 3 follow-ups
-
How does connection pooling work for outbound HTTP and SQL calls in .NET? Explain how HttpClient and SocketsHttpHandler pool connections, why PooledConnectionLifetime matters, how SQL Server connection pooling works in Microsoft.Data.SqlClient, and what pool exhaustion looks like.
Covers HTTP connection pooling in SocketsHttpHandler (lifetimes, per-server limits, HTTP/2), IHttpClientFactory, SqlClient connection pooling (Max Pool Size, pool keys, leaks) and the symptoms of pool exhaustion.
Mid-Level
Theory
API Performance
Β· π 3 follow-ups Β· π 1 real-world
-
What do HTTP/2 and HTTP/3 change for API performance? Explain multiplexing, header compression and head-of-line blocking at the HTTP and TCP level, how you enable each in Kestrel and HttpClient on .NET 10, and when they make a measurable difference.
Covers HTTP/2 multiplexing and HPACK, TCP head-of-line blocking, HTTP/3 over QUIC (QPACK, 0-RTT, connection migration), enabling them in Kestrel and HttpClient on .NET 10, and when the gain is real.
Mid-Level
Theory
API Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Your mobile app makes 25 API calls to render one screen, and some of your services call each other dozens of times per request. How do you fix chatty APIs? Compare batching, aggregate endpoints, a backend for frontend and gRPC streaming, and explain how you decide.
Covers diagnosing chatty client and service-to-service communication and reducing round trips with aggregate endpoints, batch APIs, BFFs, gRPC streaming, data ownership changes and caching, with the trade-offs of each.
Senior
Architecture
API Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Show me how you would remove N+1 calls to a downstream API. Write a batch endpoint, a client that chunks IDs into batches, and a bounded-concurrency fallback with Parallel.ForEachAsync for an API that has no batch support, and explain how you would prove it is faster.
Covers replacing per-item downstream calls with a batch endpoint, chunking with Enumerable.Chunk, bounded parallelism with Parallel.ForEachAsync and MaxDegreeOfParallelism, partial failures, and measuring the gain.
Mid-Level
Coding
API Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Under load, your ASP.NET Core API on Azure App Service starts failing calls to an external payment API and to other services with intermittent connection timeouts and SocketExceptions, while CPU and memory look fine. How do you diagnose connection or SNAT port exhaustion, and how do you fix it?
Covers diagnosing outbound connection exhaustion: per-call HttpClient, unbounded MaxConnectionsPerServer, request queueing, and Azure SNAT port exhaustion, using dotnet-counters, App Service diagnostics and netstat, and fixing it with connection reuse, NAT Gateway and private endpoints.
Senior
Debugging
API Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Code review: an order-details endpoint creates a new HttpClient for every call, calls the customer, product and shipping services one item at a time in a loop, blocks on .Result, and returns the full EF Core entity graph to the client. What problems do you find, ranked by severity, and how would you rewrite it?
A code review of an ASP.NET Core endpoint and API client covering per-call HttpClient, sync-over-async, sequential N+1 downstream calls, missing timeouts and cancellation, and over-fetching by returning the entity graph, with a ranked rewrite.
Senior
CodeReview
API Performance
Β· π 3 follow-ups Β· π 1 real-world
-
An API endpoint that reads from SQL Server through EF Core is slow, and you don't yet know where the time goes. Walk me through how you tune it end to end: from Application Insights dependency timings, to the SQL EF Core generates, to the execution plan, and how you prove each change helped.
The cross-layer method for tuning EF Core and SQL Server data access: splitting request time into app, round trips and database, finding the generated SQL, reading the plan, fixing at the right layer and verifying with numbers.
Mid-Level
Theory
EF and SQL Performance
Β· π 3 follow-ups Β· π 1 real-world
-
When would you drop down from EF Core to Dapper, raw SQL or a stored procedure for performance? What criteria do you use, how do you measure whether it is worth it, and how do you keep the codebase consistent when you do?
Deciding when EF Core should give way to SqlQuery/FromSql, Dapper or stored procedures for performance: the criteria, the evidence needed, the hidden costs and how to keep mixed data access maintainable.
Senior
Architecture
EF and SQL Performance
Β· π 3 follow-ups Β· π 1 real-world
-
A sales dashboard endpoint takes about 30 seconds and sometimes times out. It aggregates three years of orders (tens of millions of order lines) in Azure SQL through EF Core. Walk me through how you would make it fast: projection and pushing work to SQL, indexes (including columnstore), plan analysis, pre-aggregation and caching, and how you would prove each step.
An end-to-end scenario for fixing a slow reporting endpoint across EF Core and Azure SQL: measuring, server-side aggregation, columnstore and covering indexes, plan analysis, read replicas, pre-aggregated tables and caching, with evidence at each step.
Senior
RealWorldScenario
EF and SQL Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Code review: an order repository exposes GetAll() as IEnumerable<Order> and filters on it, loads each order's lines in a loop, relies on lazy loading for the customer, filters by Year and Month of CreatedAt, includes a blob Attachments collection and tracks everything, all with synchronous calls. What do you flag across EF Core and SQL Server, ranked by severity, and what does the rewrite look like?
A code review of a typical slow EF Core repository: IEnumerable client-side filtering, N+1 and lazy loading, non-SARGable date predicates, blob over-fetching, unnecessary tracking, missing indexes and sync I/O, ranked by severity with a measured rewrite.
Senior
CodeReview
EF and SQL Performance
Β· π 3 follow-ups Β· π 1 real-world
-
As the technical lead for several .NET teams, how would you set performance budgets and stop performance regressions reaching production? Explain how you choose the budgets, what you test in CI (benchmarks, query counts, load tests), what you watch after release, and how you deal with noisy results and teams pushing back.
Designing a team-wide performance budget and regression system: SLO-derived budgets, BenchmarkDotNet and SQL query-count checks in CI, scheduled load tests with pass/fail thresholds, production p95 and Query Store alerts, handling noise, and getting teams to own it.
Staff / Architect
Architecture
EF and SQL Performance
Β· π 3 follow-ups Β· π 1 real-world