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 invalidate output cache entries when data changes, and how do you make that work across several instances?
Intermediate
Theory
Application Performance
-
How do you approach a performance problem in a .NET service? Walk me through how you define the goal, measure, find the bottleneck, make a change and prove it helped.
The measurement-driven method for performance work: setting a goal in percentiles and throughput, measuring a baseline, locating the bottleneck, changing one thing and verifying the result.
Beginner
Theory
Application Performance
Β· π 2 follow-ups
-
How do you tell whether a .NET service is CPU-bound, memory-bound or I/O-bound? Which dotnet-counters metrics show each, and what does the fix look like in each case?
Classifying a slow .NET service as CPU-, memory/GC- or I/O-bound from dotnet-counters and telemetry, and the typical fix for each class.
Intermediate
Theory
Application Performance
Β· π 3 follow-ups
-
Show me how you would reduce allocations on a hot path in a .NET 10 service. Use spans, pooling, string.Create and removing LINQ and closures where they matter, and prove the improvement with BenchmarkDotNet.
Practical allocation reduction on a hot path with Span<T>, ArrayPool<T>, string.Create and removing LINQ and closure allocations, measured with BenchmarkDotNet's MemoryDiagnoser.
Mid-Level
Coding
Application Performance
Β· π 3 follow-ups Β· π 1 real-world
-
How do you make async code in .NET fast, not just correct? Explain when ValueTask helps, when you can avoid an async state machine, whether ConfigureAwait(false) matters in ASP.NET Core, and how you limit parallelism when fanning out I/O.
Async performance in .NET 10: ValueTask and pooled builders, eliding the async state machine safely, the real effect of ConfigureAwait in ASP.NET Core versus libraries, and bounding concurrent fan-out.
Mid-Level
Theory
Application Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Your ASP.NET Core API's throughput stops increasing under load while CPU is only at 40%, and latency climbs. You suspect lock contention. How do you confirm it with dotnet-counters and dotnet-trace, find the contended lock, and fix it?
Diagnosing lock contention in a .NET service with dotnet-counters (monitor-lock-contention-count), dotnet-trace contention events and dumps, then removing it with smaller critical sections, lock-free structures, sharding or immutable snapshots.
Senior
Debugging
Application Performance
Β· π 3 follow-ups Β· π 1 real-world
-
When is it legitimate to tune the .NET ThreadPool? Explain what ThreadPool.SetMinThreads actually does, how hill climbing and starvation injection decide the thread count, and why raising thread counts often just hides sync-over-async.
ThreadPool sizing in .NET 10: minimum threads, hill climbing, starvation-based injection, configuration options, why higher limits mask blocking code, and the narrow cases where tuning is justified.
Senior
Theory
Application Performance
Β· π 3 follow-ups Β· π 1 real-world
-
What is the difference between response compression, output caching and response caching in ASP.NET Core? Explain what each does, how you configure it, and when each one helps or hurts performance.
ASP.NET Core's response compression middleware, output caching (.NET 7+) and the HTTP response caching middleware: how each works, configuration, security caveats and when each improves or worsens performance.
Intermediate
Theory
Application Performance
Β· π 2 follow-ups
-
After a release, one of your services' p95 latency doubled from 180 ms to 360 ms, with no errors and no obvious change in traffic. Walk me through your end-to-end investigation and fix.
End-to-end investigation of a latency regression after a release: mitigation, comparing before/after telemetry, narrowing to an operation and dependency, profiling, root cause, fix and prevention with performance gates.
Senior
RealWorldScenario
Application Performance
Β· π 3 follow-ups Β· π 1 real-world
-
Code review: a hot-path method that runs for every incoming message chains several LINQ calls with repeated ToList(), builds a key by concatenating strings in a loop, stores values as object, and holds a lock while it writes to a database. What problems do you find, ranked by severity, and how would you rewrite it?
Reviewing a hot path for blocking I/O under a lock, unsafe shared state, repeated LINQ materialisation, string concatenation and boxing, then rewriting it and proving the improvement with measurement.
Senior
CodeReview
Application Performance
Β· π 3 follow-ups Β· π 1 real-world
-
How do you make cache invalidation survive a crash between the database commit and the cache delete?
Mid-Level
Theory
Caching
-
Why do we cache in a .NET service, and what are the main caching layers: in-memory, distributed and HTTP/CDN? How does IMemoryCache work, and why should you set a size limit on it?
The purpose of caching, the in-process, distributed and HTTP/CDN layers, IMemoryCache basics (expiration, eviction, GetOrCreateAsync) and why SizeLimit matters.
Junior
Theory
Caching
Β· π 3 follow-ups
-
How do IDistributedCache and Redis work in ASP.NET Core? Explain serialisation, the latency you should expect, what Redis is good at beyond key-value caching, and which Azure Redis offering you would choose today.
IDistributedCache over Redis: the byte-array API, serialisation cost, network latency, Redis data structures and features, connection management, and Azure Managed Redis versus the retiring Azure Cache for Redis.
Intermediate
Theory
Caching
Β· π 3 follow-ups
-
Show me how you would use HybridCache in .NET 10 to replace hand-written cache-aside code. Explain the two cache levels, how it protects against stampedes, how tags and invalidation work, and how you would prove the change helped.
HybridCache (Microsoft.Extensions.Caching.Hybrid, GA since March 2025): GetOrCreateAsync, L1/L2 behaviour, per-process stampede protection, tags and RemoveByTagAsync, serialisation, entry options, and measuring the improvement.
Mid-Level
Coding
Caching
Β· π 3 follow-ups Β· π 1 real-world
-
Compare cache-aside, write-through and write-behind caching. How does each keep the cache and the database consistent, what goes wrong when a step fails, and when would you choose each in a .NET service?
The three main caching write strategies (cache-aside, write-through, write-behind), their consistency guarantees, failure modes and race conditions, and where read-through fits, with .NET examples.
Mid-Level
Theory
Caching
Β· π 3 follow-ups Β· π 1 real-world
-
A hot cache key expires at peak and your database CPU hits 100%, timeouts spread across the API, and it recovers a few minutes later. You suspect a cache stampede. How do you confirm it, stop it now, and prevent it with locking, early refresh and jittered TTLs?
Diagnosing a cache stampede (thundering herd) from Application Insights, Query Store and cache metrics, and fixing it with request coalescing, HybridCache, distributed locks, probabilistic early refresh, stale-while-revalidate and TTL jitter.
Senior
Debugging
Caching
Β· π 3 follow-ups Β· π 1 real-world
-
How do you design cache invalidation and TTLs for a .NET service? Explain explicit invalidation, tag-based invalidation, versioned keys and stale-while-revalidate, and how you choose a TTL for a given piece of data.
Cache invalidation strategies (explicit delete, tags, versioned or generational keys, event-driven invalidation) and TTL design (absolute vs sliding, soft and hard expiry, stale-while-revalidate, jitter), with how to choose a TTL from business tolerance.
Mid-Level
Theory
Caching
Β· π 3 follow-ups Β· π 1 real-world
-
You run 20 instances of an ASP.NET Core service behind a load balancer. How would you design caching across them? Explain when to use a local cache, a distributed cache or both, how you keep local caches in sync with invalidation messages, and how you trade consistency against latency.
Multi-instance cache architecture: L1 per instance vs shared L2, two-level caching with HybridCache, invalidation via Redis pub/sub or Azure Service Bus, bounded staleness, failure modes, cold starts and how to choose per data class.
Senior
Architecture
Caching
Β· π 3 follow-ups Β· π 1 real-world
-
Users report seeing stale data, and one user saw another user's account details, served from your API's cache. How do you investigate, find the faulty cache key or design, contain the incident, and fix it so it can't happen again?
Investigating a cache that serves stale or cross-user data: incident containment, Privacy Act notifiable data breach assessment, finding missing key dimensions (user, tenant, culture, version), output and CDN caching of authenticated responses, and preventive design and tests.
Senior
RealWorldScenario
Caching
Β· π 3 follow-ups Β· π 1 real-world
-
What are the main .NET diagnostics tools? Explain what dotnet-counters, dotnet-trace, dotnet-dump, dotnet-gcdump and dotnet-monitor each tell you, and which one you reach for first when a service misbehaves.
The .NET diagnostics CLI toolbox: what dotnet-counters, dotnet-trace, dotnet-dump, dotnet-gcdump and dotnet-monitor each capture, their overhead, and the order you use them in.
Junior
Theory
Profiling
Β· π 3 follow-ups