📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Phase 17 — Distributed Systems

How distributed .NET systems behave and fail: partial failure, latency and consistency models, microservice boundaries, messaging with Service Bus, RabbitMQ and Kafka, reliability patterns, and keeping data consistent across services.

  1. A team makes what looks like a small change in one service, and three other services start failing in production within an hour. How do you diagnose it, find the hidden coupling (shared database, shared library, synchronous call chains, shared message contracts), and stop it happening again?

    Diagnosing a change in one microservice that breaks others: using traces, deployment markers and dependency maps to find hidden coupling through shared databases, shared NuGet libraries, synchronous call chains and message contracts, then mitigating and removing it.

    Senior Debugging Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  2. Your company has around 40 microservices, six teams, and delivery has slowed down: most features need changes in several services and releases are coordinated. How would you assess whether to consolidate services, decide which ones to merge, and carry it out without stopping feature work?

    Assessing an over-split microservices estate with data (change coupling, call graphs, ownership, cost and DORA metrics), deciding which services to merge into fewer, team-aligned services or a modular monolith, and executing the consolidation incrementally with stakeholder buy-in.

    Staff / Architect Architecture Microservices Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  3. What is the difference between a queue and a topic (publish/subscribe)? Explain competing consumers, why putting a message broker between two services decouples them, and when you would still make a direct HTTP call instead.

    Covers point-to-point queues versus publish/subscribe topics and subscriptions, the competing consumers pattern, the kinds of decoupling a broker gives (time, location, load) and when synchronous HTTP is still the right choice.

    Junior Theory Messaging Β· πŸ”— 3 follow-ups
  4. How do Azure Service Bus, RabbitMQ, Apache Kafka and Amazon SQS differ? Compare their messaging models, ordering, retention and replay, delivery guarantees and operating cost, and tell me how you would choose one for a new .NET system.

    Compares queue brokers (Azure Service Bus, RabbitMQ, Amazon SQS) with Kafka's partitioned log on model, ordering, retention and replay, delivery guarantees, throughput and operations, and gives a decision approach for .NET teams.

    Intermediate Theory Messaging Β· πŸ”— 3 follow-ups
  5. Explain message delivery guarantees: at-most-once, at-least-once and exactly-once. Why do people call exactly-once delivery a myth, what do Kafka transactions and Service Bus duplicate detection really give you, and how do you get effectively-once processing in a .NET consumer?

    Covers at-most-once and at-least-once delivery, where duplicates come from, why end-to-end exactly-once delivery is impossible over an unreliable network, what broker features (Kafka idempotent producer and transactions, Service Bus duplicate detection, SQS FIFO dedup) actually guarantee, and how idempotent consumers deliver effectively-once processing.

    Mid-Level Theory Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. Write an Azure Service Bus consumer as a .NET 10 hosted service using ServiceBusProcessor. Show how you complete, abandon and dead-letter messages, set concurrency and prefetch, handle lock renewal and cancellation on shutdown, and tell me what delivery guarantee your consumer gives and how it handles duplicates.

    Covers building a production Service Bus consumer with ServiceBusProcessor in a BackgroundService: settlement (complete, abandon, dead-letter), MaxConcurrentCalls and PrefetchCount, auto lock renewal, graceful shutdown with cancellation, error handling, DI with Microsoft.Extensions.Azure and idempotent processing.

    Mid-Level Coding Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. How do you keep messages in order in a distributed system? Explain Azure Service Bus sessions, Kafka partition keys and SQS FIFO message groups, what breaks ordering (competing consumers, retries, dead-lettering, repartitioning), and how you design so you don't need global ordering at all.

    Covers why ordering is expensive, per-key ordering with Service Bus sessions, Kafka partitions and SQS FIFO message groups, what breaks order (parallel consumers, retries, DLQ, rebalancing, repartitioning), and design alternatives: commutative updates, version numbers and state-carrying events.

    Mid-Level Theory Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. Your Service Bus queue's active message count keeps climbing, the dead-letter queue has thousands of messages, and logs show the same few messages failing over and over. How do you diagnose what is going on, deal with the poison messages and the backlog, and fix it so it doesn't happen again?

    Covers diagnosing a growing Service Bus backlog with poison messages: reading DLQ reasons and properties, distinguishing poison messages from a failing dependency, settlement mistakes that cause loops, safe DLQ resubmission, scaling consumers against the downstream limit, and alerting and testing to prevent recurrence.

    Senior Debugging Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. Explain Kafka for a .NET engineer: topics and partitions, consumer groups, offsets and commits, and rebalancing. What causes consumer lag, how do you commit offsets safely with Confluent.Kafka, and what delivery guarantee does your consumer end up with?

    Covers Kafka's partitioned log model, consumer groups and partition assignment, offset commit strategies in Confluent.Kafka (auto commit, StoreOffset, manual Commit), rebalancing (eager versus cooperative-sticky, max.poll.interval.ms), consumer lag and its causes, and the resulting at-least-once guarantee with idempotent processing.

    Senior Theory Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  10. After a four-hour outage of a downstream system, your Service Bus subscription has a backlog of about 2 million messages, and new messages are still arriving. Walk me through your recovery plan: how you drain it without overwhelming the recovered system, what you do about ordering, duplicates and stale messages, and how you keep the business informed.

    Covers recovering from a 2-million-message backlog after an outage: assessing message types and staleness, throttled draining sized to the downstream, prioritising new traffic, ordering and idempotency during catch-up, discarding or archiving expired messages, monitoring progress and communicating ETAs to stakeholders.

    Senior RealWorldScenario Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  11. Code review: a colleague's Service Bus message handler for OrderPaid calls a third-party shipping API to book a courier, saves a Shipment row with EF Core, and publishes a ShipmentBooked event, with no idempotency and auto-complete turned on. What problems do you find, how do you rank them, and how would you rewrite it?

    Covers reviewing a message handler with side effects: duplicate courier bookings from at-least-once delivery, swallowed exceptions with auto-complete, the dual write between the database and the broker, missing idempotency keys, lost cancellation, blocking calls, logging gaps, and a rewrite using an inbox, outbox and provider idempotency key.

    Senior CodeReview Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  12. How would you test that your fallbacks and degraded modes actually work before a real outage?
    Mid-Level Theory Reliability Patterns
  13. How do you shut down an ASP.NET Core service in Kubernetes without dropping in-flight requests during a rolling deploy?
    Senior Architecture Reliability Patterns
  14. Your service calls a downstream API through HttpClient with a timeout, retries, a circuit breaker and a concurrency limit. In what order do you compose these, and why does the order matter? How do timeout budgets and deadlines work when the call is one hop in a chain of services?

    Composing resilience strategies in the right order (limiter, total timeout, retry, circuit breaker, attempt timeout), what goes wrong with the wrong order, and timeout budgets and deadline propagation across a chain of distributed .NET services.

    Mid-Level Theory Reliability Patterns Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  15. What are fallback and graceful degradation in a distributed system? How do you serve cached or partial data when a dependency fails, how do feature switches help, what should the user see, and when must you fail closed instead of falling back?

    Fallback strategies (cached, default, partial and alternative responses), graceful degradation of non-critical features, feature switches and kill switches, what to show users, and when a system must fail closed rather than fall back.

    Mid-Level Theory Reliability Patterns Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  16. Your API is overloaded: latency climbs, requests queue and eventually everything times out. How do you shed load at the edge of the service instead of falling over? Explain bounded queues and concurrency limits, the ASP.NET Core rate limiting middleware, 503 versus 429 with Retry-After, priority-based shedding, and how well-behaved clients should respond.

    Load shedding at the service edge: why unbounded queues cause collapse, Little's law sizing, ASP.NET Core rate limiting and concurrency limiters, 503 versus 429 with Retry-After, priority shedding, and client behaviour that keeps the system recoverable.

    Senior Theory Reliability Patterns Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  17. You are designing health checks for a fleet of .NET services behind load balancers and Kubernetes. How do you make health checks tell the truth? Explain liveness, readiness and startup checks, which dependencies belong in which, how health checks cause cascading restarts and outages, and how you implement and secure them in ASP.NET Core.

    Designing truthful health checks across a distributed estate: liveness vs readiness vs startup, which dependencies to check where, how probes cause cascading restarts and fleet-wide outages, and implementing, tuning and securing ASP.NET Core health checks.

    Senior Architecture Reliability Patterns Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  18. During a database slowdown, traffic to your inventory service jumps to eight times normal while user traffic is flat, and a small incident becomes a 45-minute outage across five services. You suspect a retry storm. How do you prove it, stop it, and fix it with retry budgets so it can't happen again?

    A retry storm across a five-service call chain: proving retry amplification with distributed traces and metrics, stopping it during the incident, and preventing it with single-layer retries, retry budgets, Retry-After, circuit breakers and jitter.

    Senior RealWorldScenario Reliability Patterns Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  19. Why do cloud systems avoid distributed transactions and two-phase commit? Explain how 2PC works, where it breaks (blocking, in-doubt transactions, availability, locks across the network), what .NET 10 and Azure still support, and what you use instead to keep data consistent across services.

    Two-phase commit and distributed transactions: the prepare and commit protocol, its blocking and availability failure modes, current .NET and Azure support (MSDTC on Windows only, elastic transactions, no broker enlistment), and the replacements: one transaction by design, outbox with idempotent consumers, sagas, reservations and reconciliation.

    Mid-Level Theory Data Consistency Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  20. Your event-sourced system needs a new read model, and an existing projection has a bug that corrupted its data. How do you replay events to rebuild projections? Explain checkpoints, rebuilding side by side and switching over, what happens to side effects such as emails and integration events during a replay, and why handlers must be idempotent.

    Event replay in event-sourced and event-driven systems: rebuilding projections from the event store or a retained log, checkpoints and positions, blue-green projection rebuilds, separating projections from side-effect handlers, idempotent and deterministic handlers, and replay speed and ordering.

    Senior Theory Data Consistency Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me