Microsoft .NET Developer Interview Questions & Answers

microsoft icon

Questions with Detailed ExplanationsWith Detailed Explanations

(Last Updated: August 28, 2026)

21. Explain how relational-database transactional guarantees should be exposed through an application API.API DesignHardMicrosoft

Question Details

Explain the outward-facing behavior callers should expect from transactional APIs, including rollback, isolation, and failure visibility.

Short Interview Answer (30-60 seconds)

At a high level, I would expose clear transaction outcomes through the API while letting the relational database enforce ACID guarantees. The client sends an HTTPS POST /orders request to the API Endpoint. The application validates and authorizes it, runs the business operation, and keeps all related database changes inside one transaction. The transaction either commits everything or rolls everything back. The API returns clear success or failure responses with Problem Details. The trade-off is that stronger isolation gives safer concurrency behavior but can increase locking and reduce throughput.

Detailed Explanation

This question asks how an API should behave when one request changes several pieces of database data. The caller needs to know whether the whole operation succeeded or failed. The caller should never see half-finished work. The API should also explain what other callers may see while changes are happening. When something fails, the caller needs a clear result instead of guessing. The diagram solves this by keeping transaction handling inside the application and database while exposing simple success, conflict, validation, and server-error outcomes to the caller.

Useful Questions to Ask the Interviewer
  • Which isolation level should this API use for normal requests?
  • Should create-like operations support safe retries through idempotency?
  • Which business or concurrency conflicts should return 409?
Explain how relational-database transactional guarantees should be exposed through an application API. diagram
How to Explain It in an Interview
1. Start with the API boundary

I would first keep the caller-facing contract simple. The API Client sends an HTTPS POST /orders request to the API Endpoint. The endpoint validates the input and authorizes the caller. It starts the transaction scope for the request. The caller does not need to understand database transaction commands. It only needs a clear API result. This keeps the public API contract separate from the database implementation.

2. Run the business operation through the application service

The API Endpoint sends the use case to the Application Service. The Application Service orchestrates the operation and applies business rules. It can also perform an idempotency check when that behavior is used. Data access then continues through ADO.NET or EF Core to the Unit of Work. The Unit of Work begins the database transaction and keeps the related reads and writes inside that transaction. This allows the complete business operation to succeed or fail as one unit.

3. Let the relational database enforce ACID

The Unit of Work sends SQL commands to the Relational Database while the transaction is active. The database enforces atomicity, consistency, isolation, and durability. Atomicity means all transaction changes commit together or none commit. Consistency means constraints and valid committed state are preserved. Isolation controls what concurrent transactions can observe. Durability means committed data survives later system or database failures. The API should document the chosen isolation level and explain what that level does and does not guarantee. The diagram shows Read Committed as the default, with Repeatable Read, Snapshot, and Serializable as other possible levels.

4. Commit or roll back before exposing the result

If every operation succeeds, the Unit of Work commits the transaction. The committed changes then become visible as the successful result. If an operation fails, the Unit of Work rolls the transaction back. No partial transaction result becomes visible to other callers. The database returns results or errors to the Unit of Work. This keeps rollback as an internal transaction action while the caller receives a clear outward-facing outcome.

5. Map failures into stable API responses

Failures go through Exception Handling & Mapping. That component maps domain and database failures into stable HTTP errors. It includes useful failure details without leaking personally identifiable information. The mapped response returns to the API Endpoint and then back to the API Client over HTTPS. The diagram shows 2xx for committed success, 409 for a business-rule or concurrency conflict, 4xx for caller validation errors, and 5xx for an unexpected server failure. Error responses use Problem Details and include a correlation ID for tracing and support.

6. Explain the caller-facing guarantees and trade-offs

The caller should expect all-or-nothing changes, documented isolation behavior, valid committed state, durable commits, and explicit failure responses. Rollbacks should not expose partial data. For safe retries, create-like operations should define idempotency behavior. Transactions should stay short because long transactions can increase lock contention. Stronger isolation can make concurrent behavior safer and easier to reason about, but it can reduce throughput. The API should therefore document the actual isolation level and retry behavior instead of promising stronger guarantees than the database configuration provides.

Practical Complexity & Trade-offs

The benefit of this design is that callers get a simple API contract while the database handles transaction correctness. Related changes stay inside one transaction, so partial updates are not exposed. The API also converts internal failures into stable HTTP outcomes and Problem Details. The downside is that stronger isolation can increase locking or other concurrency costs and reduce throughput. Long transactions can make contention worse, so the diagram recommends keeping transactions short. Idempotency can make retries safer for create-like operations, but it requires extra application logic. Correlation IDs and consistent error mapping also add implementation work. We accept these costs because they make failures clearer, retries safer, and transactional behavior easier to operate and support.

Why Interviewers Ask This

Interviewers want to see whether you can separate database guarantees from the public API contract. They are checking whether you understand commit, rollback, isolation, failure visibility, and HTTP error behavior. They also want sound judgment around concurrency conflicts, idempotency, short transactions, and stable error responses. A strong answer shows that you can explain what callers may rely on without promising guarantees that the selected database isolation level does not actually provide.

Interviewer may ask next
What should happen if the client does not know whether a POST /orders request committed and wants to retry it?

I would keep the same transaction flow and use the idempotency behavior already shown in the Application Service. The client can retry the POST /orders operation according to the API's documented retry contract. The Application Service checks whether the same create-like operation was already completed before repeating business work. If the earlier transaction committed, the application should return the existing logical result instead of creating another order. If the earlier transaction rolled back, the retry can execute normally in a new transaction. The Unit of Work still owns the database transaction work, and the Relational Database still enforces ACID. Exception Handling & Mapping and Problem Details also stay unchanged. This reduces the risk that an uncertain response creates duplicate data. The downside is extra application logic and idempotency state. The API must also define how long that state remains useful. I would document this behavior clearly instead of claiming that every network retry is automatically safe.

How would you choose the transaction isolation level when many callers update data concurrently?

I would choose the isolation level that protects the required business rules while still allowing acceptable concurrency, and I would document that choice in the API contract. The Unit of Work begins the transaction using the selected isolation behavior, while the Relational Database enforces it. The diagram shows Read Committed as the default and also lists Repeatable Read, Snapshot, and Serializable. Stronger levels can prevent more concurrency anomalies, but they may increase blocking or other database work. If concurrent activity causes a business-rule or concurrency conflict, Exception Handling & Mapping can return the shown 409 response instead of exposing a provider-specific database error. The rest of the request and response path remains unchanged. I would also keep transactions short to reduce contention. The main downside of stronger isolation is lower concurrency or higher database cost. The important point is to document the real guarantee rather than promise that every caller sees perfectly isolated behavior.

22. Design Azure API Gateway architecture for routing, rate limiting, and authentication.System DesignHardMicrosoft

Question Details

Design the gateway service as an internal platform component, emphasizing routing decisions, rate limiting, auth checks, and the behavior under partial outage.

Short Interview Answer (30-60 seconds)

At a high level, this gateway gives clients one controlled entry point to internal .NET services. The main challenge is keeping authentication, authorization, rate limits, and routing consistent while handling partial failures safely. I would explain the design in three parts: the synchronous request path, the shared platform services, and failure handling. Requests pass through Azure Front Door and six gateway stages before reaching a private backend service. The trade-off is stronger central control, but shared gateway dependencies must remain highly available.

Detailed Explanation

The goal is to give different clients one safe way to reach internal .NET services. Every request must pass the right security checks, traffic limits, validation, and routing rules. The difficult part is keeping these rules consistent while still serving healthy routes during partial failures. The diagram solves this with one ordered gateway pipeline. It keeps shared policy, rate-limit state, monitoring, secrets, and background integration around that pipeline so the main request path stays clear.

Useful Questions to Ask the Interviewer
  1. Which clients need access, and do any require client certificates?
  2. Should rate limits differ by user, route, or client type?
  3. Which routes may return cached or predefined fallbacks during an outage?
  4. Which operations may be accepted for background processing?
Design Azure API Gateway architecture for routing, rate limiting, and authentication. diagram
How to Explain It in an Interview
1. Explain how requests enter

I would start with the normal request path. Web, mobile, partner, and IoT clients send HTTPS traffic to Azure Front Door. Front Door forwards the request to the internal Azure API Gateway. The response returns through Front Door to the client. The gateway is deployed as containerized .NET 8 or .NET 10 services on Azure Container Apps. It can scale out and use multiple zones.

2. Walk through the six gateway stages

The first stage is TLS Termination and WAF. It handles TLS offload, OWASP rules, IP filtering, and request-size limits. Authentication then validates JWT or OAuth2 credentials. It can use AAD or B2C, token introspection, and optional client-certificate or mTLS authentication.

Authorization checks scopes, roles, policies, and ABAC or RBAC rules. Validation checks the request schema, content type, and model binding. These checks happen before backend routing.

3. Explain rate limiting and routing

Rate Limiting and Throttling applies global, per-user, and per-route rules. It supports burst limits, sustained limits, and quotas. Shared rate-limit state is kept in Redis with a primary and replica.

After those checks pass, Routing selects the backend using path, host, method, headers, query values, versioning, and canary or weighted rules. The gateway then calls the selected private .NET service over HTTPS with mTLS.

4. Explain the supporting platform services

Policy and Configuration includes Azure App Configuration, Key Vault, Feature Flags, and the Gateway Policy Store. These provide settings, secrets, certificates, and policy definitions. Cross-cutting concerns include correlation IDs, structured logging, metrics, tracing, audit information, caching, response shaping, and compression.

Observability uses Azure Monitor, Application Insights, Log Analytics, and Alerts. Azure Service Bus handles queued background work. Event Grid carries domain events. These asynchronous paths do not need to block the normal synchronous response.

5. Explain partial outages and scaling

I would finish with failure behavior. Timeouts, bounded retries with exponential backoff, circuit breakers, and bulkhead isolation limit the effect of failing services. The gateway continues serving requests when the dependencies needed by those requests are healthy. If required authentication or policy state cannot be checked, it rejects the request safely.

Safe routes may use cached responses or predefined fallbacks. Operations designed for background handling may enqueue accepted work to Service Bus. Gateway replicas stay stateless, while shared state remains in Redis and App Configuration. The main trade-off is central control versus dependency risk. Central rules are easier to keep consistent, but those shared services must be designed for high availability.

Engineering Considerations / Design Trade-offs

The benefit is that routing, security checks, and rate limits are controlled in one place. This makes behavior more consistent across backend services. Stateless gateway replicas can also scale out when traffic grows. Shared state stays in Redis and App Configuration instead of one gateway process. The downside is that these shared services become important dependencies. If required authentication or policy information cannot be checked, some requests must fail safely. Redis replication improves availability, but it adds another moving part. Cached fallbacks and background queues help only on routes that were designed to use them safely.

Why Interviewers Ask This

Interviewers use this question to test whether you can organize a gateway request path clearly. They want to see if you place authentication, authorization, validation, rate limiting, and routing in sensible stages. They also test your judgment around shared state, private services, monitoring, retries, scaling, and partial outages. The important skill is explaining what each control protects and what should happen when a dependency fails.

Interviewer may ask next
What would you change if the Redis rate-limit store became unavailable during a traffic spike?

I would keep the same gateway design, but I would define the rate-limit failure rule very clearly. The affected part is the Rate Limiting and Throttling stage and its shared Redis Rate Limit Store. If Redis is unavailable, the gateway should not pretend that global counters are still exact.

For sensitive or expensive routes, I would fail safely instead of allowing unlimited traffic. For routes where temporary reduced protection is acceptable, a predefined policy could allow limited fallback behavior. That decision must be configured before the outage.

The gateway replicas should remain stateless. I would not let each replica create its own independent global counter because those counters would disagree. The Redis replica may help when the primary fails, depending on the available replicated state.

Azure Monitor, Application Insights, Log Analytics, and Alerts should make the problem visible quickly. The main downside is availability. Strong rate-limit protection can reject valid requests while the shared rate-limit state is unavailable.

How would the design behave if one backend .NET service failed while the other services stayed healthy?

I would keep the gateway and healthy routes running. Only requests routed to the failed backend should be affected. The gateway already has timeouts, bounded retries with exponential backoff, circuit breakers, bulkhead isolation, and optional safe fallbacks.

A timeout prevents the gateway from waiting too long. A circuit breaker stops repeated calls to a service that is clearly failing. Bulkhead isolation helps stop that failure from consuming resources needed by other routes. Retries should stay bounded and should only be used when retrying that operation is safe.

If the route supports a cached response or predefined fallback, the gateway may use it. If the operation was explicitly designed for background handling, accepted work may be placed on Azure Service Bus for later processing.

Other backend services continue receiving traffic normally. The downside is that the failed service may return errors or reduced functionality until it recovers.

23. Construct a system for managing event sourcing in a decentralized architecture.System DesignMediumMicrosoft

Question Details

Explain how events are written, replicated, and replayed across decentralized components, and how the system preserves ordering and recoverability.

Short Interview Answer (30-60 seconds)

At a high level, the goal is to keep a reliable history of every change across decentralized services. The hard part is preserving event order while still supporting replication and recovery. I would explain this in three flows: writing events, publishing committed events, and rebuilding state. Commands append ordered events to the replicated event store. Background workers build read models, while replay restores state when needed. The main trade-off is stronger write consistency versus lower write availability when a quorum is unavailable.

Detailed Explanation

The system must keep every important change as an event instead of storing only the latest state. Those events are copied across decentralized storage nodes, so their order must stay correct even when nodes fail or lose network access. The design separates the problem into a secure write path, a replicated event store, background processing, read models, and replay. The key rule is simple: first commit the event safely, then use that saved history to publish updates, build query views, or recover lost state.

Useful Questions to Ask the Interviewer
  1. Do we need strict ordering only inside each event stream?
  2. Should writes stop when the replicated store cannot form a quorum?
  3. How quickly must read models reflect newly committed events?
Construct a system for managing event sourcing in a decentralized architecture. diagram
How to Explain It in an Interview
1. Start with the request and security checks

I would start by saying that client requests enter through the Security & Gateway layer. The gateway handles authentication, authorization, validation, rate limiting, and throttling. TLS protects communications shown in the design.

The request then moves to the Command API in the .NET Application Layer. The Domain Model & Aggregates apply the business rules. An aggregate is the business unit whose events must stay in the correct order.

2. Commit the event before background work

For the write path, the Event Store Client appends the new event to the Decentralized Event Store. The store keeps append-only event streams. Each stream uses a sequence or version so events have a clear order inside that stream.

The event store is replicated across peers using consensus. Enough nodes must agree before the write is accepted. During a network partition, nodes without quorum cannot accept writes. This protects the ordered event history.

Each Event Record contains Stream Id, Event Type, JSON payload, metadata, Version or Sequence, Timestamp, Causation Id, and Correlation Id. These fields help preserve ordering and trace related work.

3. Publish committed events and build read models

After an event is committed, the Integration Event Publisher reads committed events from the Event Store. It publishes integration events toward the Message Bus and external integrations. The Message Bus uses at-least-once delivery, so the same event may be delivered more than once.

The BackgroundService Projection Builder consumes events and builds the Read Models / Projections. These query stores include a Relational DB, Document DB, and Cache. Processing is idempotent, which means handling the same event again must not produce an incorrect duplicate result.

4. Replay events for recovery

The Replay Service reads an ordered stream or range from the Decentralized Event Store. It replays those events over time to rebuild state or projections. Because the original event history is retained, a damaged projection can be recreated from the stored events.

Failed consumers can resume from their last processed sequence. This supports recovery after crashes or restarts without changing the stored event history.

5. Scale, observe, and explain the trade-off

The application services are stateless, so they can scale horizontally. Read models can scale separately for query workload. Observability & Diagnostics collects structured logs, metrics, traces, and alerts.

The main trade-off is consistency versus write availability. Consensus preserves correct ordering during failures, but nodes without quorum cannot accept writes. Read projections can also be slightly behind because they are updated in the background.

Engineering Considerations / Design Trade-offs

The benefit is that the complete event history stays available for replay and recovery. Replication also removes one storage node as the only point of failure. Stateless services and read models can scale separately. The downside is extra complexity. Consensus keeps writes correct, but a node without quorum must stop accepting new writes. Background projections may be slightly behind the newest committed event. At-least-once delivery can also send the same event more than once, so workers must handle duplicates safely. Replaying a long event stream may take time, but the saved history makes rebuilding possible.

Why Interviewers Ask This

Interviewers ask this to see whether you can separate durable event writes from background processing. They want to know if you understand per-stream ordering, replication, replay, and recovery. They also test your judgment around consistency and availability. A strong answer explains why events are committed before publication, why consumers must safely handle duplicates, and how stored history can rebuild state after failures.

Interviewer may ask next
What would you change if the business requires writes to remain available during a network partition?

I would keep the same basic design, but I would have to weaken the current write rule. Today, the Decentralized Event Store uses consensus. A node without quorum cannot accept writes, which protects the ordered history of each stream.

If isolated nodes must continue accepting writes, two network sides could create different events for the same stream before they reconnect. The system would then need a rule for deciding the final event order after connectivity returns.

That change affects the Decentralized Event Store most directly. The Integration Event Publisher and Projection Builder should not treat conflicting histories as final until the store has decided which ordering is valid.

The main downside is much more complexity. We gain write availability during a partition, but we lose the simple strong ordering guarantee provided by the current quorum-based design.

How would you handle a Projection Builder that crashes after processing an event but before saving its progress?

I would keep the same BackgroundService Projection Builder and at-least-once delivery approach. After the crash, the same event may be processed again because the worker may not have saved its last processed sequence.

The main protection is idempotent processing. This means applying the same event again must leave the Read Models / Projections in the same correct state. The worker can use the event sequence or stored event identity to recognize work that was already applied.

After handling the duplicate safely, the worker continues from its saved position. If a projection becomes badly damaged, the Replay Service can rebuild it by reading the ordered event history from the Decentralized Event Store.

The downside is extra tracking and duplicate-handling logic inside the worker. That cost is expected because the design uses at-least-once delivery rather than exactly-once processing.

24. Design a distributed system for managing task queues.System DesignMediumMicrosoft

Question Details

Describe queue partitioning, worker coordination, retry behavior, and the failure handling required to keep tasks moving in a distributed environment.

Short Interview Answer (30-60 seconds)

At a high level, I would separate accepting a task from doing the background work. The main challenge is keeping tasks moving when workers or processing steps fail. I would explain the design in three flows: accepting and publishing tasks, processing them with workers, and handling retries or failed tasks. A transactional outbox prevents a database and queue write gap. Partitioned queues and worker leases help the system scale. The trade-off is more moving parts and more operational complexity.

Detailed Explanation

The goal is to accept work quickly, save it safely, and process it in the background. The difficult part is that machines can stop, messages can appear again, and some tasks can keep failing. The system must keep useful work moving without losing tasks or retrying bad tasks forever. The diagram separates this into task acceptance, safe queue publication, worker processing, retries, and failed-task handling. It also shows how partitions spread work and how monitoring helps operators find stalled or unhealthy parts of the system.

Useful Questions to Ask the Interviewer
  1. Do tasks need to stay ordered within the same partition?
  2. How long should a task remain available before retention removes it?
  3. How many retries should happen before a task goes to the Dead Letter Queue?
  4. Can the same task be processed more than once?
Design a distributed system for managing task queues. diagram
How to Explain It in an Interview
1. Start with task acceptance

For the request path, a client sends an HTTPS request through the API Gateway / Edge. The gateway handles authentication, authorization, validation, rate limiting, and the request ID.

The .NET 8/10 Web API accepts the enqueue request. It checks the idempotency key, which helps detect the same request being sent again. The service creates the task and writes an outbox record inside the same Relational DB transaction.

The service returns the enqueue response and task ID through the API Gateway / Edge. The gateway then returns the HTTP response to the client. The task itself is processed later in the background.

2. Publish the task safely

The Outbox Relay Process is a .NET BackgroundService. It polls pending outbox records from the Relational DB.

The relay is the normal publisher to the Task Queue. It publishes each pending task message and then marks the outbox record as published. This avoids the gap where the database write succeeds but a separate queue write is lost.

The Task Queue is split into partitions. Each partition is durable and append-only. The queue also shows retention, at-least-once delivery, and a visibility timeout or lease.

3. Coordinate workers and process tasks

The .NET Worker Service uses BackgroundService consumers. A Partition Leases Manager coordinates worker ownership of partitions.

Concurrent Message Fetchers fetch leased messages. The Task Processor runs the business logic and may call External Services / APIs. The Result / State Updater saves success or failure information in the Relational DB.

At-least-once delivery means a message can appear again. The worker therefore needs safe repeated processing, so running the same task again does not create a wrong result.

4. Retry temporary failures

If processing fails for a temporary reason, the Retry / Backoff Handler sends the task to the Retry Queue. Backoff means waiting before trying again.

When the delay expires, the Retry Queue requeues the task into the Task Queue. This prevents immediate retry loops and gives temporary problems time to recover.

If the task keeps failing or reaches the retry limit, it moves to the Dead Letter Queue. This isolates poison or failed tasks from normal work.

5. Handle failures, scale, and operations

The Dead Letter Queue sends failed tasks to Manual / Automated Inspection & Reprocessing. After the problem is understood and fixed, that process can explicitly requeue the task.

Metrics, Structured Logs, Alerts, Dashboards, and Distributed Tracing show queue depth, failures, high retries, stalled partitions, system health, and request flow. These signals help operators find problems quickly.

Producer and worker replicas are stateless where possible, so they can scale horizontally. The broker and Relational DB remain stateful. Communication uses HTTPS, and secrets come from a configuration provider or Key Vault.

The main trade-off is complexity. Partitioning improves scale, while leases, retries, outbox processing, and failure recovery add more operational work.

Engineering Considerations / Design Trade-offs

The benefit is that task acceptance stays separate from task execution. A slow worker does not need to block the client request. Partitioning also lets workers process different groups of tasks in parallel. The downside is that the design has several moving parts. The outbox relay, partition leases, Retry Queue, and Dead Letter Queue all need monitoring. At-least-once delivery also means a task may appear again, so workers must handle repeated processing safely. More partitions can improve scale, but they also make worker coordination and operations more complex.

Why Interviewers Ask This

Interviewers ask this question to see whether you can design reliable background processing instead of only drawing a queue and some workers. They want to see how you divide work, coordinate consumers, retry temporary failures, isolate poison tasks, and avoid losing work between the database and queue. They also want to hear clear trade-offs between scale, reliability, and operational complexity.

Interviewer may ask next
What would you change if tasks for the same customer must always be processed in order?

I would keep the same basic architecture, but I would make the partition choice use the customer key. Tasks for one customer would always go to the same Task Queue partition. That lets the design keep their relative order inside that partition.

The Partition Leases Manager would still coordinate worker ownership. A worker with that partition lease would fetch and process its messages. If the worker fails, the visibility timeout or lease allows another worker to continue later.

Retries also need to preserve the same partition choice. When the Retry Queue delay expires, the task should be requeued using the same customer key. That prevents a retry from moving to a different partition.

The main downside is uneven load. One very busy customer can make one partition much busier than others, which can reduce parallel processing for that customer's work.

How would the design handle a worker that crashes while processing a task?

I would keep the existing lease and visibility-timeout design. When a worker fetches a task, the lease makes that task temporarily unavailable to other workers. If processing finishes normally, the worker updates the result or state and completes its work.

If the worker crashes before completion, it cannot finish or renew the lease. After the visibility timeout expires, the task can become available again for another worker. This keeps work moving without waiting for the failed worker to return.

Because the queue uses at-least-once delivery, the new worker may receive a task that partly ran before the crash. The Task Processor must therefore handle repeated processing safely. The task state and idempotency information help prevent incorrect duplicate effects.

The downside is that some work may run more than once. The design accepts that cost so a worker crash does not silently lose the task.

25. Design Teams chat service architecture for real-time messaging, presence, and message ordering.System DesignHardMicrosoft

Question Details

Architect the live chat system for many concurrent users, with presence updates, ordered delivery, and clear handling for reconnects and missed messages.

Short Interview Answer (30-60 seconds)

At a high level, this system must deliver chat messages quickly while keeping messages ordered inside each conversation. The hard parts are real-time delivery, presence, and reconnecting without losing messages. I would explain three flows: sending a message, pushing live updates, and replaying missed messages. Stateless .NET services use SQL for stored chat data, Redis for presence and sequence state, and an Event Bus for background delivery. The trade-off is extra operational complexity for reliable real-time behavior.

Detailed Explanation

The goal is to let many people chat at the same time and see new messages quickly. Messages inside each conversation must appear in the right order. The system must also show presence, such as whether someone is online. A phone or browser can lose its connection at any time, so reconnecting users must receive messages they missed. The diagram separates normal chat requests, live WebSocket delivery, and reliable background delivery. Stored chat history lets the system recover after temporary connection failures.

Useful Questions to Ask the Interviewer
  1. Should ordering be guaranteed only inside one conversation?
  2. How quickly should presence changes appear to other users?
  3. How long should missed messages remain available for replay?
  4. Do attachments need the same delivery guarantees as text messages?
Design Teams chat service architecture for real-time messaging, presence, and message ordering. diagram
How to Explain It in an Interview
1. Start with the client and secure entry path

I would start with how users enter the system. Desktop, mobile, and web clients use HTTPS for normal requests. The web client also shows a WSS connection for live updates. Azure Front Door or Application Gateway is the entry point. WAF and DDoS protection filter harmful traffic. Microsoft Entra ID handles OAuth 2.0 or OIDC sign-in. JWT validation checks the signed user claims. Rate limiting controls excessive requests by IP, user, or tenant.

2. Explain the message write path

For a new message, the Chat REST API sends work to the Message Service. This service validates and enriches the message before saving it. The Conversation Service checks the conversation, members, and permissions. The Ordering Service assigns per-conversation sequence information. It also helps detect duplicate messages and sequence gaps. The SQL Database Primary stores conversations, messages, users, and memberships. Redis stores sequence counters and idempotency keys. An idempotency key lets the system recognize the same client request sent again.

3. Explain presence and live delivery

For live updates, the Real-time Gateway manages WebSocket or SignalR connections. The Presence Service handles heartbeats and user status changes. Redis stores presence, user sessions, and connection-related state. The design also uses SignalR backplanes with Redis so horizontally scaled service replicas can reach connected users. The gateway then fans messages and presence updates out to the correct active connections.

4. Explain reliable background delivery and reconnects

Reliable delivery uses an Outbox Table in SQL. The message write saves durable delivery work there before background publishing happens. The Outbox Publisher polls the table and publishes events to the Event Bus. Fan-out Workers consume those events and deliver them through the Real-time Gateway. If processing keeps failing, poison work can move to the Dead Letter Queue. Retries use exponential backoff, which increases the delay between attempts. When a client reconnects, it sends its last-seen sequence. The server then replays missing messages from stored chat history.

5. Explain scale, failures, security, and trade-offs

The .NET services are stateless, so the system can add more replicas horizontally. Data is partitioned using tenant or conversation information. SQL read replicas support reporting or search reads. Blob or Object Storage holds attachments and media. The Search Index supports full-text search. Structured logs, metrics, distributed tracing, and alerts help operators find problems. TLS protects traffic. JWT tokens, RBAC, input validation, WAF rules, rate limits, and tenant isolation protect access. The main downside is complexity. Redis, WebSockets, background workers, retries, and event delivery all need careful operation.

Engineering Considerations / Design Trade-offs

The benefit is fast live chat with clear handling for ordering and reconnects. Redis makes presence and sequence checks fast, but it adds cost and memory pressure. The outbox and Event Bus make background delivery safer, but they add more moving parts. Events can arrive more than once, so consumers must safely ignore duplicate work. Some event-driven features may update a little later. Stateless services make horizontal scaling easier, but WebSocket connections still need shared SignalR backplane support. We accept this extra complexity because keeping chat reliable during failures and reconnects is more important than having the simplest possible design.

Why Interviewers Ask This

Interviewers ask this question to see whether you can break a real-time system into clear flows. They want to test your judgment about message ordering, presence, reconnects, durable storage, and background delivery. They also want to see whether you understand horizontal scaling, duplicate processing, security, and failure handling. A strong answer explains these choices clearly and discusses the trade-offs without claiming impossible guarantees.

Interviewer may ask next
What would you change if users frequently switch between mobile networks and Wi-Fi, causing many reconnects?

I would keep the same architecture, but I would put more focus on the reconnect path. The client already keeps its last-seen sequence for each conversation. After a new WebSocket or SignalR connection is created, the client sends that sequence to the service. The server compares it with stored chat history and replays the messages that came later. This keeps the replay correct because missed messages come from durable stored data instead of temporary connection state.

The Ordering Service still uses per-conversation sequence information to keep the replay in order. Client-generated message IDs and idempotency keys also help when the client is unsure whether its last send succeeded. If it sends the same request again, the service can recognize the duplicate.

Presence may briefly change while the network switches. The Presence Service and Presence Cleaner handle that temporary state. The downside is more replay traffic and more work during large reconnect bursts.

How would this design handle an Event Bus failure while users are still sending messages?

I would keep accepting messages while the main SQL write path remains healthy. The important protection is the Outbox Table. The message and its durable delivery work are saved in SQL before the Outbox Publisher tries to publish to the Event Bus. If the Event Bus is unavailable, that work stays in the outbox and can be retried later.

Retries use exponential backoff, so repeated failures do not create a tight retry loop. If a specific event repeatedly fails during processing, the Retry and DLQ Processor can move poison work to the Dead Letter Queue for investigation. Consumers must handle duplicate delivery safely because the design uses at-least-once publishing rather than exactly-once processing.

The SQL Database Primary still holds the stored messages. Reconnecting clients can therefore recover missed messages later. The downside is delayed real-time delivery while the Event Bus is unavailable.

26. Create a system for identifying fraudulent transactions.System DesignEasyMicrosoft

Question Details

Design the fraud-detection flow at a high level, covering ingestion, scoring, review, and the decision path for transactions that are blocked or escalated.

Short Interview Answer (30-60 seconds)

At a high level, the system must score each transaction and quickly decide whether to approve, block, or review it. The main challenge is making that decision fast while using enough fraud signals to make a useful choice. I would explain three flows: secure transaction ingestion, real-time scoring and decisioning, and background review and learning. The .NET application coordinates the main path, while the event stream handles slower work. The trade-off is that richer fraud checks add processing and operational complexity.

Detailed Explanation

The system must examine each transaction and decide whether it looks safe or suspicious. Normal transactions should move forward quickly. High-risk transactions should be blocked, while uncertain transactions should be sent for human review. The hard part is making a useful fraud decision without slowing every request too much. The diagram solves this with a secure ingestion path, a real-time scoring and decision path, and background work for feature updates, model training, alerts, auditing, and analyst review.

Useful Questions to Ask the Interviewer
  1. Which transaction sources must the system support first?
  2. How should the business choose thresholds for approve, block, and review?
  3. Which fraud signals are available when the transaction arrives?
  4. How quickly must an escalated case reach an analyst?
Create a system for identifying fraudulent transactions. diagram
How to Explain It in an Interview
1. Start with secure transaction ingestion

I would first make sure every transaction enters through a controlled path. Mobile apps, web apps, and partner services send an HTTPS transaction request to Security & Edge. This layer provides WAF and DDoS protection, OAuth 2.0 or JWT authentication, validation, rate limiting, and idempotency checks. A validated request then reaches the Transaction API inside the ASP.NET Core application. The API accepts the transaction, adds a correlation ID, performs basic validation, and records request logs.

2. Build features and calculate the risk score

Next, the Transaction API sends a transaction command to the Fraud Orchestrator. The orchestrator builds the features needed for fraud detection and calls the Scoring Engine. The Scoring Engine combines rules evaluation with ML model inference. It returns a risk score from 0 to 1000 together with explanation factors. The scoring path can read the features, profiles, rules, recent transactions, and model information shown in the diagram. Redis holds fast-changing profile, device, velocity, and recent-transaction data.

3. Decide whether to block, approve, or escalate

The Fraud Orchestrator passes the result into the Decision Service. The Decision Service applies thresholds and policies and produces reason codes. A high-risk transaction follows the Block path and becomes declined. A low-risk transaction follows the Approve path and becomes approved. An uncertain transaction follows the Escalate path and enters Queue for Review. The application then returns an approved, declined, or escalated response through Security & Edge to the original client.

4. Handle review and background processing

For an escalated transaction, the system creates a case event for the Fraud Analyst Console. The analyst can inspect case details, timeline, evidence, and notes, then approve or decline the case. That analyst decision reaches Final Decision Applied, which updates the database and sends notifications. Transaction and decision events also flow through the Event Stream using Kafka or Azure Event Hubs. Background consumers update the Feature Store, retrain and validate models, send alerts and notifications, and create audit and compliance reports.

5. Explain storage, operations, and the trade-off

The Operational DB stores transactions, decisions, users, and rules. The Historical Data Store keeps data for analytics and model training. The Model Registry stores model versions and metadata. Observability includes structured logging, metrics, distributed tracing, dashboards, and alerts. Cross-cutting controls include configuration, secrets management, resilience policies, and caching. The main trade-off is simple: using rules, ML, several stores, and human review can improve fraud decisions, but it creates more services and dependencies to operate reliably.

Engineering Considerations / Design Trade-offs

The benefit is that the system keeps the transaction decision separate from slower background work. Rules and ML can use several fraud signals, while feature updates, model training, alerts, and reporting happen outside the main response path. Redis can make frequently used profile, device, velocity, and recent-transaction data faster to access. The downside is more moving parts. The event stream, stores, model pipeline, analyst review flow, and monitoring all need to stay healthy. Richer scoring can also take more time. We accept this complexity because obvious fraud can be blocked quickly while uncertain cases still receive human review.

Why Interviewers Ask This

Interviewers use this problem to see whether you can break a business problem into clear flows. They want to see how you separate the fast transaction decision from background work, combine rules with machine learning, handle human review, and store the right information. They also look for judgment around security, monitoring, resilience, and trade-offs instead of a memorized architecture.

Interviewer may ask next
What would you change if the fraud-scoring path became too slow during a large traffic spike?

I would keep the same basic architecture and protect the real-time transaction path first. Security & Edge already provides rate limiting, so it can limit excessive request pressure before work reaches the application. Inside the .NET application, the Transaction API and Fraud Orchestrator should stay focused on scoring and deciding the transaction. Background work should remain behind the Event Stream instead of moving into the request path.

I would use the existing Feature Store or Cache for profile, device, velocity, and recent-transaction data when those values are available there. Observability would help identify whether the delay comes from the Scoring Engine, a data store, or another dependency. The existing Polly resilience policies can help the application handle temporary dependency problems. The downside is that stricter limits and resilience rules need careful tuning, because protecting the system may reduce how much traffic it can process during a large spike.

How would the design handle a large increase in transactions that require manual fraud review?

I would keep the same decision flow, but I would focus on the Escalate path and the analyst workload. The Decision Service would still use its thresholds and policies to decide which transactions need review. Those transactions would continue through Queue for Review, and the system would create case events for the Fraud Analyst Console.

The console already gives analysts case details, timeline, evidence, notes, and approve or decline actions. Their decision then goes to Final Decision Applied, which updates the database and sends notifications. The Event Stream can continue carrying the related case and decision events to background processing, including auditing and reporting.

This keeps human review away from transactions that can be approved or blocked automatically. The downside is that a larger review queue can increase the time before an escalated transaction receives its final decision.

27. What are the key components and considerations in designing a real-time newsfeed?System DesignEasyMicrosoft

Question Details

Describe the main feed-building components, update flow, ranking inputs, and the constraints that make a feed feel live to end users.

Short Interview Answer (30-60 seconds)

At a high level, the goal is to build a newsfeed that feels live while keeping normal feed reads fast. The main challenge is combining fresh posts, user relationships, ranking signals, and real-time updates at scale. I would explain it through the feed read path, the write and background update path, and live delivery. Redis keeps common feed reads fast, a durable Message Queue supports background fan-out, and SignalR pushes live updates. The trade-off is more complexity and a small delay for some background updates.

Detailed Explanation

The goal is to show each user a useful newsfeed and make new activity appear quickly. The difficult part is that many users may read feeds while posts, reactions, follows, mutes, and blocks keep changing. The system must find suitable items, rank them, remove unwanted items, and deliver fresh changes without making normal reads slow. The diagram separates this work into a fast feed-read path, a durable background processing path, and a real-time delivery path. Redis helps with fast reads, while background workers handle work that does not need to block the user request.

Useful Questions to Ask the Interviewer
  1. How quickly should a new post appear in followers' feeds?
  2. Should ranking favor freshness, engagement, relationships, or user preferences?
  3. How much delay is acceptable during heavy traffic?
  4. Which clients need live SignalR updates and push notifications?
What are the key components and considerations in designing a real-time newsfeed? diagram
How to Explain It in an Interview
1. Start with the client and entry path

I would first explain how requests enter the system safely. Mobile apps, the Web SPA, and desktop apps are the clients. The CDN or Edge layer serves static content such as images and video thumbnails. Requests that reach the API Gateway pass through TLS, authentication, authorization, validation, rate limiting, and request routing before entering the .NET newsfeed service.

2. Explain the feed read path

For a feed read, the Feed Read API works with the Feed Orchestrator. The orchestrator coordinates candidate fetching, ranking, filtering, enrichment, and fallback behavior. The Candidate Fetcher gets possible items from the Cache Layer or stores. The Ranking Engine scores and sorts them using signals such as recency, engagement, relationships, content relevance, and user preferences. The Deduplicator / Filter removes repeated or unwanted items. The Enricher adds related user, media, or ad information. Redis keeps per-user or home timeline data and item data close to the service for fast access.

3. Explain writes and background fan-out

For writes, the Feed Write API handles actions such as creating posts and reactions. The User Graph API handles follow, unfollow, mute, and block changes. Change Capture uses an Outbox Pattern to write domain events. These events go to the durable Message Queue. Feed Builder Workers consume them, fan out updates to followers, update user timelines, and make incremental changes. The Timeline Store keeps per-user timelines using a NoSQL or wide-column style store.

4. Explain indexing, notifications, and live updates

Indexing Workers update the Search Index, trending data, aggregates, and counters. Push Notification Workers batch and send push notifications to devices. Background failures can retry, and failed work can move to a dead-letter path instead of blocking the main request. The Real-time Hub uses SignalR or WebSockets for live updates. A Redis SignalR backplane helps multiple replicas coordinate those real-time messages. Media is kept in the Media Store, while events and metrics go to the Analytics Store.

5. Explain scaling, reliability, and operations

The .NET services can scale horizontally across multiple replicas, zones, or regions. The Timeline Store can be partitioned, and caching reduces database reads. Durable messaging provides backpressure, which means work can wait when producers are temporarily faster than workers. The design accepts eventual consistency for fan-out, meaning some background updates may appear a little later. Consumers should handle repeated events safely. TLS, authentication, authorization, data minimization, user controls, and compliance protect the system. Structured logs, metrics, distributed tracing, alerts, and dashboards help operators find problems. The main trade-off is that fast reads and live updates require more infrastructure and operational work.

Engineering Considerations / Design Trade-offs

The benefit is that common feed reads can stay fast because Redis keeps useful timeline and item data close to the service. Background workers also keep fan-out, indexing, and notification work away from the main request path. The downside is extra complexity. The queue, workers, caches, several stores, and SignalR all need monitoring and recovery. Some updates may appear a little later because background work is not instant. Horizontal scaling improves capacity, but replicas need shared real-time coordination. We accept these costs because the design keeps the user-facing feed responsive while still handling large amounts of changing data.

Why Interviewers Ask This

Interviewers use this question to see whether you can break a large feature into clear flows. They want to understand how you keep reads fast, move expensive work into the background, choose useful ranking signals, and deliver live updates. They also look for good judgment about caching, durable messaging, scaling, security, failure handling, and the trade-off between freshness and system complexity.

Interviewer may ask next
What would you change if a new post had to appear in followers' feeds almost immediately?

I would keep the same basic architecture, but I would give more importance to the real-time path after the write is accepted. The Feed Write API would still handle the post, and Change Capture would still create a domain event through the Outbox Pattern. That event would enter the durable Message Queue so the update is not lost if a worker temporarily fails.

Feed Builder Workers would process the event quickly and update follower timelines. The Cache Layer could then hold the changed timeline for fast reads. The Real-time Hub would use SignalR or WebSockets to tell connected clients that fresh feed data is available. The Redis SignalR backplane would help when the hub runs across several replicas.

I would keep the durable queue instead of replacing it with only live delivery. The downside is extra load on workers, Redis, and live connections. Very large fan-out events may still take time, so every follower cannot be guaranteed the exact same delivery moment.

How would the design handle a sudden burst of posts and reactions without overwhelming the feed service?

I would use the controls already shown in the design. The API Gateway would continue applying validation and rate limiting so bad or excessive requests do not freely enter the service. Valid changes can still be accepted while expensive fan-out and indexing work moves through the durable Message Queue.

The queue provides backpressure, which means work can wait safely when workers cannot process it immediately. Feed Builder Workers and Indexing Workers can scale horizontally across more replicas. Redis reduces repeated reads from the underlying stores, and the partitioned Timeline Store spreads timeline data across storage capacity. Failed background work can retry or move to the dead-letter path.

The design stays correct because accepted events remain in durable processing rather than being silently dropped. The main downside is freshness. During a large burst, timeline updates, search data, counters, or push notifications may appear later even though the main service stays responsive.

28. Design OneDrive file sync architecture with conflict resolution and delta sync.System DesignHardMicrosoft

Question Details

Design a multi-device file-sync architecture with delta updates, version reconciliation, and recovery from conflicting edits or offline changes.

Short Interview Answer (30-60 seconds)

At a high level, the goal is to keep the same files synchronized across many devices, even when users work offline or edit the same file at the same time. The hard part is sending only changed data while keeping file versions correct. I would explain three flows: delta upload and download, version and conflict handling, and background storage and notifications. The design uses stateless .NET services, versioned storage, and a version graph. The trade-off is extra version logic for lower bandwidth and better offline support.

Detailed Explanation

The system must keep a user’s files synchronized across Windows, macOS, mobile, and the web. A device may lose its connection, change a file, and reconnect later. Two devices may also change the same file before either device receives the other change. The design handles this by transferring only changed data, keeping old file versions, and preserving conflicting edits when an automatic merge is unsafe. I would explain the client sync path first, then version handling, then the background work that stores changes and notifies devices.

Useful Questions to Ask the Interviewer
  1. How large can files become, and how often are they changed?
  2. Should automatic merging be allowed for every file type or only safe cases?
  3. How long should old versions and deleted data be retained?
  4. How quickly should a committed change appear on another device?
Design OneDrive file sync architecture with conflict resolution and delta sync. diagram
How to Explain It in an Interview
1. Start with the client sync loop

I would start with the Local Sync Engine because it knows what changed on each device. It uses a File System Watcher, Change Journal, File Chunking, and rolling-hash Delta Detection. It also keeps a Local Cache and Offline Store, so work can continue while the device is disconnected.

For an upload, the client sends delta data and metadata over HTTPS. For a download, it requests changed data and metadata instead of downloading every file again. Backoff and Retry help when a request temporarily fails.

2. Explain how requests enter the service

The request passes through the CDN, WAF and DDoS Protection, and API Gateway. The gateway applies rate limiting, throttling, authentication, and authorization. A validated request then reaches the .NET 8 backend services.

The Sync API Service handles delta upload and download. The Metadata Service handles file and folder metadata, permissions, sharing, and quotas. The Auth Service validates tokens and delegated access.

3. Explain versions and conflicts

The Versioning Service maintains the Version Graph and detects conflicts. Blob Storage keeps file chunks, versioned blobs, and version history. The Version Index stores the Version Graph and reconciliation state, which means information used to compare competing file histories.

When two devices create divergent edits, both branches are preserved. The Conflict Resolution Service can auto-merge safe cases. Otherwise, the Conflict UI shows the versions and choices to the user. After the user selects or manually merges them, a new unified version is committed and devices can be updated.

4. Explain the background pipeline

Background work goes through the Ingestion Queue. The Delta Processor BackgroundService deduplicates, validates, and normalizes work. The Reconciliation Worker BackgroundService builds the version graph, detects conflicts, and applies safe merge strategies.

The Storage Writer BackgroundService stores chunks, updates metadata, and indexes versions. The Notifier Worker BackgroundService sends web push, optional email, or in-app alerts. These are hosted background workers. Task-based async I/O is different: it lets a .NET process wait for network or storage operations without treating each Task as a durable queue item.

5. Close with scale, security, and operations

The .NET services run as multiple stateless instances in Azure App Service or Container Apps. Managed threads and the ThreadPool belong to each running process, while separate instances do not share ordinary process memory.

The Metadata DB stores users, files, folders, permissions, quotas, devices, and sync state. Redis caches hot metadata, session data, and throttling counters. Key Vault stores keys, secrets, and certificates.

Application Insights, Log Analytics, dashboards, Distributed Tracing, Synthetic Tests, and SLOs monitor the system. Security includes TLS 1.2 or later, encryption at rest, RBAC, audit logs, data residency, retention, and legal hold. The main trade-off is lower bandwidth and stronger offline support at the cost of more client, version, and conflict-handling complexity.

Engineering Considerations / Design Trade-offs

The benefit of delta sync is that it sends only changed data, so large files use less bandwidth. The downside is more client and server logic for chunking, hashes, versions, and conflicts. Stronger metadata consistency makes version decisions safer, but it can reduce availability and performance across regions. Offline support is useful, but the Local Cache and Offline Store use more disk space and make conflicts harder. Auto-merge simplifies safe cases, while manual resolution protects complex edits. Strong encryption and access controls protect data, but they add authentication work. CDN, caching, and tiered storage improve performance, but they also add cost and operational complexity.

Why Interviewers Ask This

Interviewers ask this to see whether you can break a difficult storage problem into clear flows. They want to know if you understand delta sync, offline changes, version history, and conflicts between devices. They also look for judgment about background processing, storage choices, security, scaling, and failure handling. The important skill is explaining why each choice helps and what downside it creates.

Interviewer may ask next
How would you change this design if users often edit the same file on two offline devices for several hours?

I would keep the same basic architecture, but I would rely more heavily on the Version Graph and Conflict Resolution Service. Each device would continue saving changes in its Offline Store and Change Journal while disconnected. When it reconnects, it would upload its delta data and metadata through the normal Sync API path.

The Versioning Service would compare that branch with the versions already stored. If the edits can be combined safely, the Conflict Resolution Service can auto-merge them. If they cannot, both versions should remain available and the Conflict UI should show the user the choices instead of overwriting either edit.

The Reconciliation Worker can perform the heavier version comparison in the background. After a safe merge or a user decision, the Storage Writer saves the new unified version and updates metadata and indexes. The Notifier Worker can then alert other devices.

The main downside is more stored versions, more version-graph work, and more cases that may need manual resolution.

What would you do if the Ingestion Queue starts growing faster than the background workers can process it?

I would keep the same queue-based design and scale the background workers that are falling behind. The Ingestion Queue already separates incoming work from the Delta Processor, Reconciliation Worker, Storage Writer, and Notifier Worker. That lets the system absorb a temporary burst without turning a Task into a durable work queue.

Because the workers are stateless service instances, more instances can be added where needed. The API Gateway can also use its existing rate limiting and throttling controls if incoming work becomes unsafe for the rest of the system.

Application Insights, Log Analytics, dashboards, Distributed Tracing, and SLOs should show growing delay, worker errors, and slow processing. Correctness still matters, so the workers should not skip validation, conflict detection, metadata updates, or version indexing simply to catch up.

The main downside is slower synchronization while the backlog exists and higher compute cost while extra workers are running.

29. Create a system to manage customer support tickets efficiently.System DesignEasyMicrosoft

Question Details

Design a ticket-management workflow that lets support agents create, triage, assign, and resolve tickets while keeping status changes visible to everyone involved.

Short Interview Answer (30-60 seconds)

At a high level, I would build one shared ticket system for agents and customers. The main challenge is keeping ticket state correct while notifications, search, SLA checks, and audit work happen efficiently. I would explain three flows: the secure ticket request, fast reads and search, and background processing. Stateless .NET services use a primary database, Redis, a message broker, workers, a read replica, and a search index. The trade-off is that background views can briefly lag behind the main ticket data.

Detailed Explanation

The system must help support teams create, triage, assign, update, and resolve customer tickets. Everyone involved should see important changes without making the main ticket action slow. The hard part is keeping the ticket record correct while also handling search, notifications, SLA checks, attachments, reporting, and audit work. The diagram organizes this into a secure entry path, stateless .NET services, persistent stores, and background workers. The main database keeps ticket data, while slower side work can happen separately.

Useful Questions to Ask the Interviewer
  1. Which ticket states and assignment rules are required?
  2. How quickly should status changes become visible to participants?
  3. What attachment sizes and file types must we support?
  4. Which email, chat, identity, or CRM systems must connect?
Create a system to manage customer support tickets efficiently. diagram
How to Explain It in an Interview
1. Start with the secure entry path

I would first explain how requests enter the system safely. Web agents, mobile agents, inbound email, live chat, and customer self-service all reach the Edge & Security layer. The API Gateway accepts HTTPS traffic. Authentication and authorization use OIDC or OAuth2. Rate limiting and the WAF protect the service from abusive or unwanted traffic.

After these checks, the request enters the stateless .NET application layer. Stateless means one service instance does not depend on local user state. That makes horizontal scaling easier because several instances can sit behind a load balancer.

2. Process the ticket in the .NET application layer

For ticket work, the Ticket API handles create, update, read, comments, and attachments. The Triage Service categorizes tickets, sets priority, detects duplicates, and adds tags. The Assignment Service can use skills, round-robin, or workload rules. The Workflow Service controls status transitions, SLA rules, escalations, and approvals. The Notification Service handles email, in-app messages, mentions, status updates, and subscriptions.

The Primary Database stores tickets, users, organizations, SLA data, comments, and audit data. It is the main stored record for ticket state. Redis is a performance layer for lookups, sessions, rate counters, and search cache. It does not replace the Primary Database.

3. Handle search, reporting, and attachments

For search, the Search API supports full-text search, filters, saved views, and pagination. The Search Index stores ticket content in a form optimized for full-text queries. A Read Replica supports reporting and scale. It can be slightly behind the Primary Database, so reports may briefly show older data. Attachments are kept in Blob Storage instead of placing large files in the ticket database.

4. Move side work to asynchronous processing

After ticket activity, the application can publish events to the Message Broker. The diagram shows RabbitMQ or Azure Service Bus as examples. Background services run as .NET hosted workers and consume that work asynchronously, which means it happens separately from the main request.

The Email Dispatcher Worker sends notifications and replies. The SLA Monitor Worker checks SLAs and creates escalations. The Reindex Worker updates the Search Index. The Audit Logger Worker writes audit records. Keeping this work in the background reduces work on the main request path.

5. Explain integrations, operations, and trade-offs

The system integrates with email, chat, an identity provider, file storage, and optional CRM or asset systems. Observability includes structured logging, metrics, tracing, alerts, and dashboards. Multiple service instances, backups, retries, and health monitoring improve availability.

The main trade-off is simple. Ticket transactions stay correct in the Primary Database, but reporting, search results, and other background updates may appear a little later.

Engineering Considerations / Design Trade-offs

The benefit is that the main ticket path stays focused on correct ticket data. Redis makes common lookups faster and reduces database work. Background workers keep email, SLA checks, search updates, and audit work away from the main request. The downside is that these background results may appear a little later. A Read Replica helps reporting scale, but it may briefly show older data. The Search Index makes full-text search fast, but it must be updated separately. Running several service instances improves availability, but adds work for health checks, retries, backups, logs, metrics, and alerts.

Why Interviewers Ask This

Interviewers use this question to see whether you can break one business problem into clear system flows. They want to know if you can keep the main ticket state correct while moving slower work into the background. They also look for good judgment around caching, search, reporting, security, scaling, and failures. Most importantly, they want to hear clear trade-offs instead of a memorized list of technologies.

Interviewer may ask next
What would you change if ticket status updates had to become visible to participants within a few seconds?

I would keep the same architecture, but I would focus on reducing delay in the existing notification and background paths. The Primary Database would still store the correct ticket state first. After that update, the application would publish the related event to the Message Broker. The Notification Service and background workers would process the event quickly and send the existing email or in-app updates.

I would watch queue delay, worker health, and notification failures using the observability tools already shown in the diagram. If the broker has more pending work, I could run more worker instances because those workers are separate from the main request path.

Correctness still comes from the Primary Database. A delayed notification must never overwrite or redefine the stored ticket state. The main downside is that a tight visibility target needs more worker capacity, stronger monitoring, and careful retry handling.

How would the system behave if the Search Index or Read Replica temporarily fell behind the Primary Database?

I would keep the Primary Database as the correct source for ticket state. The Search Index and Read Replica are supporting read systems, so they can be slightly behind without changing the official ticket record. A recently changed ticket may therefore appear late in search or reporting for a short time.

The Reindex Worker continues updating the Search Index through background processing. If it falls behind, the observability components should expose that delay through logs, metrics, traces, and alerts. The Read Replica can also show older information until its copy catches up.

For an action that must use the newest ticket state, I would use the normal ticket path backed by the Primary Database instead of relying on these secondary read systems. The downside is that users may briefly see different information between the ticket view, search results, and reports.

30. Build a social platform for short-form content like Twitter.System DesignEasyMicrosoft

Question Details

Design a lightweight social feed system for short posts, focusing on publishing, fan-out, and the main read path that keeps content current.

Short Interview Answer (30-60 seconds)

At a high level, this system lets people publish short posts and quickly read a current home feed. The main challenge is keeping reads fast while fan-out work grows with the number of followers. I would explain the write path, the home-feed read path, and the background processing path. Stateless .NET services handle requests, Redis and read-optimized storage speed reads, and background workers build timelines. The trade-off is that timeline updates can appear a little later.

Detailed Explanation

The goal is to let people publish short posts and see fresh posts from people they follow. Publishing should feel quick, even when one post must reach many followers. Reading the home feed should also stay fast. The design separates normal user requests from work that can happen in the background. I would explain it through the request entry path, publishing and fan-out, the home-feed read path, and the supporting failure and scaling choices.

Useful Questions to Ask the Interviewer
  1. How fresh must the home timeline be after someone publishes a post?
  2. Do we expect some users to have much larger follower counts than others?
  3. How much delay is acceptable for timeline updates and notifications?
Build a social platform for short-form content like Twitter. diagram
How to Explain It in an Interview
1. Explain how requests enter safely

I would start with the common request path. Mobile, web, and third-party clients send HTTPS requests through DNS and the Global Load Balancer. The edge also provides WAF and DDoS protection. The CDN serves static assets and media delivery.

Inside Security & Access, the Auth Service uses OAuth 2.1 or OIDC. The API Gateway handles routing and TLS termination. The Rate Limiter applies per-user or per-IP limits. Request Validation and Anti-Abuse checks reject unsafe requests before they reach the application services.

2. Explain publishing and user data

For the write path, the validated request reaches the Tweet Service. The diagram shows the write flow as create tweet, save it, and then publish an event. Tweet data and metadata go to the Tweet Store Write DB, shown as Cassandra or ScyllaDB.

The User Service handles profile and follow operations. User information, profiles, and follow relationships are stored in the PostgreSQL User Store. Keeping these responsibilities separate lets the stateless services scale independently.

3. Explain fan-out and background processing

After a tweet is saved, its event goes through the Message Broker, shown as Azure Service Bus or Kafka. The Fan-out Worker Service processes that work in the background and updates followers' timelines using the push model shown in the diagram.

The Timeline Worker Service handles timeline work. The Notification Worker Service handles notification work. These workers run as BackgroundService consumers. The diagram also shows events such as TweetCreated, Followed, Mentioned, Liked, and Retweeted. Retries and idempotent jobs make repeated processing safe when temporary failures occur.

4. Explain the main read path

For reads, the Feed Service handles the read API, while the Timeline Service represents the home feed. Redis caches timelines and also supports counters and rate-limit data. The read path can use cached data or the Tweet Store Read DB for speed.

The read database uses Cassandra or ScyllaDB and is denormalized for reads. Search requests go through the Search Service to the OpenSearch Search Index for full-text and hashtag search. Media and attachments use Blob Storage and can be delivered through the CDN.

5. Explain scale, consistency, and operations

The .NET application services are stateless and can scale horizontally. The diagram shows .NET 8 or .NET 10 services using C# 12 or C# 14, Kestrel, managed threads, and Task-based asynchronous operations.

Health checks, retries, timeouts, and circuit breakers help with temporary failures. Logging, Prometheus metrics, OpenTelemetry tracing, alerting, Grafana dashboards, and audit logs support operations. Timeline updates use eventual consistency, which means followers may see a new post after a small delay. That delay is the main trade-off of background fan-out.

Engineering Considerations / Design Trade-offs

The benefit is that publishing can stay quick because fan-out work happens through the Message Broker and background workers. Redis and the read database also help keep home-feed reads fast. The downside is that follower timelines may not update at exactly the same moment. This is eventual consistency, which means a new post can appear after a small delay. Stateless services can scale independently, which helps when traffic grows. Retries, timeouts, circuit breakers, and idempotent jobs improve resilience, but they add operating complexity. We accept that complexity to keep the main user paths fast and reliable.

Why Interviewers Ask This

Interviewers ask this question to see whether you can break a large social system into clear flows. They want to see how you separate publishing, fast reads, and background fan-out. They also test whether you understand caching, read-optimized storage, queues, scaling, security, and failure handling. A strong answer explains why each part exists and clearly describes the trade-off between quick publishing and slightly delayed timeline updates.

Interviewer may ask next
What would you change if some users had millions of followers and fan-out became much slower?

I would keep the same basic architecture, but I would scale the fan-out path independently. The Tweet Service would still save the post before publishing its event to the Message Broker. The Fan-out Worker Service would then handle the larger amount of follower work in the background.

Because the services and workers are designed to scale out independently, I could run more fan-out worker instances when this path becomes busy. The Timeline Worker Service can also scale separately as timeline work grows. This keeps the original publishing request from waiting for every follower timeline to finish.

Correctness still depends on idempotent jobs. That means retrying the same background job must not create incorrect duplicate results. The main downside is freshness. A very large fan-out may take longer to finish, so some followers may see the new post later than others.

What happens if the Redis Cluster becomes unavailable while users are reading their home feeds?

I would keep the same read architecture, but the Feed Service would use the database path when Redis cannot serve the timeline. The diagram already shows the home timeline being served from cache or database for speed. The Tweet Store Read DB is denormalized for reads, so it provides the read-side storage when the cache is unavailable.

Timeouts and circuit breakers should stop requests from waiting too long on a failing Redis Cluster. Health checks, metrics, tracing, alerting, and dashboards help operators see the problem quickly. Once Redis is healthy again, the system can return to its normal cache-assisted read path.

The design remains correct because Redis is used as a caching layer rather than the only post store. The main downside is performance. Reads may become slower, and the read database may receive more traffic until Redis recovers.

More questions load as you scroll

Disclaimer: This interview guide is for educational and informational purposes only. It is designed to help readers prepare, but it does not guarantee any interview result, hiring decision, offer, or outcome. Interview questions, hiring criteria, and preferred answers can vary by employer, interviewer, industry, location, and time. The examples and explanations reflect the authors' research and judgment, are provided without warranties of any kind, and should not be treated as the only correct approach. Diagrams are simplified illustrations intended to highlight the main components and their interactions; actual systems and implementations may be more complex. Alternative approaches may be equally valid or better suited to a particular question, context, or interviewer. To the fullest extent permitted by applicable law, the author, contributors, and publisher are not liable for decisions made, actions taken, or losses incurred based on this guide.

Company Notice: This guide is an independent educational resource and is not affiliated with, endorsed by, sponsored by, or approved by the company named in this guide. Company names are used only to identify interview experiences commonly reported by candidates. Interview practices can change without notice, and inclusion of company-specific content does not mean these questions are official, complete, or guaranteed to be asked. To the fullest extent permitted by law, the author, contributors, and publisher are not responsible for outcomes related to use of this material.