Module 1 · Interview Method and the Request Path · Lesson 1 of 23
How to Run a System Design Interview as a .NET Developer
A system design interview for a .NET developer starts with requirements, not Azure services. Estimate demand, propose a simple design, then explain its risks and trade-offs.
The interviewer needs to hear why your design fits the problem. Use a small online shop as a running example, but keep the same method for booking, messaging or reporting systems.
How should you spend 45 minutes in a system design interview?
Agree on the scope before drawing boxes. Otherwise, you may spend half the interview designing product search when the interviewer cares about placing orders.
Use this agenda as a guide, not a rigid script:
| Minutes | Work | What you should have afterwards |
|---|---|---|
| 0–7 | Clarify requirements and exclusions | A short, agreed problem statement |
| 7–12 | Estimate demand | Numbers that influence design choices |
| 12–18 | Sketch API and data | Main operations, records and relationships |
| 18–28 | Draw the design | A complete path for the main operation |
| 28–40 | Explore one or two risks | Behaviour when requests run at the same time, are slow, or fail |
| 40–45 | Close | Trade-offs, remaining risks and validation steps |
For the shop, you might agree to cover order creation and order lookup. Product recommendations and warehouse planning stay outside this interview.
Explain decisions aloud: “I’ll start with order placement because it contains the most important correctness rules. Is that the flow you want to focus on?”
The mistake to avoid. Do not silently spend 30 minutes perfecting the first diagram. You need time to show how the design behaves when things go wrong.
In an interview, say: “I’ll clarify scope and targets, estimate demand, sketch the API and data, then propose a simple design. I’ll explore the biggest risks and finish with trade-offs and next steps.”
What requirements should you clarify before designing?
Functional requirements describe what users can do, such as placing an order or viewing its status.
Non-functional requirements describe the qualities and limits the system must meet, such as response speed (latency), availability, consistency, security, expected traffic and cost. For this shop, ask about each of them.
Latency is the time from starting an operation until its result is available. Availability describes whether customers can use the system successfully when they need it. Consistency describes what guarantees readers receive about seeing changes to data.
A business rule states something that must remain true. An assumption fills an information gap temporarily; it is not an agreed requirement until you confirm it.
Keep a compact worksheet:
| Category | Shop example | What to clarify |
|---|---|---|
| Function | Customers create and retrieve orders | Are cancellation and payment included? |
| Measurable target | Order lookup p99 latency below 300 ms | Under what traffic, measured from where? |
| Business rule | Available stock must never become negative | What happens when two buyers want the last item? |
| Assumption | One million daily active users | Is this a reasonable planning figure? |
| Exclusion | Recommendations are outside scope | Does the interviewer agree? |
We will unpack p99 in the next section. For now, notice how a number makes “fast” testable.
Ask about normal traffic, peaks and the read/write mix: how many operations read data versus change it. Ask how old displayed data may be, what must not be lost, and what must not happen twice. Data that is older than the latest saved version is called stale; staleness is how far behind it is, and acceptable staleness is how far behind it may be.
For example, a slightly old product description may be acceptable. Confirming two purchases of the last item may not be.
Also ask where customers and data must be located. A cloud region is a geographical deployment area. Serving several regions can change response times, recovery options, cost and data-handling requirements.
The mistake to avoid. Do not turn an unanswered question into a hidden promise. Write “assumed” beside an unknown and ask the interviewer to accept or change it.
In an interview, say: “I’ll confirm the functional requirements, what users need to do, then the non-functional ones: speed, availability, security and cost. I’ll confirm traffic peaks, read/write mix, acceptable staleness, loss, duplicates and regions, then make targets measurable and correctness rules testable.”
What do p99 latency and availability targets mean?
For a concrete p99 example, consider 100 requests with measured latencies of 2, 4, 6 milliseconds, and so on, up to 200 milliseconds. Sort the measurements from fastest to slowest and find the 99th result:
int[] latenciesMs = Enumerable.Range(1, 100).Select(n => n * 2).ToArray();
Array.Sort(latenciesMs);
int p99Ms = latenciesMs[98];
Console.WriteLine($"p99: {p99Ms} ms");
Console.WriteLine($"Requests at or below p99: {latenciesMs.Count(ms => ms <= p99Ms)} of 100");p99: 198 ms Requests at or below p99: 99 of 100
An average can look healthy while a small group of customers experiences very slow requests.
For the shop, propose an end-to-end target: “Order lookup p99 below 300 ms, measured where the request enters our API during the agreed peak traffic.” Separately measure failed requests so that quick errors do not look like good service.
Fan-out means one request calls several dependencies. More calls can increase the chance that the request encounters a slow dependency. Measure the complete operation, not just each individual call.
A service-level objective, or SLO, is a specific, measurable target you set for a customer interaction. An availability SLO needs a counting rule:
- A time-based target counts unavailable time.
- A request-based target counts the share of failed requests among the requests that count toward the target. For example, you might exclude requests rejected because the client sent bad data. It does not directly specify outage minutes.
For time-based availability over 30 days, 99.99% permits about 4.3 minutes unavailable. At 99.9%, that becomes 43.2 minutes.
Independent means one component failing does not make the other more likely to fail. For example, they do not share a database or a power supply.
Predict the two combined availability figures, then run this calculation:
using System;
using System.Globalization;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
double minutesIn30Days = 30 * 24 * 60;
foreach (double availability in new[] { 0.9999, 0.999 })
{
double unavailableMinutes = minutesIn30Days * (1 - availability);
Console.WriteLine($"{availability:P2}: {unavailableMinutes:F2} unavailable minutes");
}
double componentAvailability = 0.999;
double bothRequired = componentAvailability * componentAvailability;
double eitherSufficient = 1 - Math.Pow(1 - componentAvailability, 2);
Console.WriteLine($"Two independent required components: {bothRequired:P4}");
Console.WriteLine($"Two independent redundant copies: {eitherSufficient:P4}");99.99 %: 4.32 unavailable minutes 99.90 %: 43.20 unavailable minutes Two independent required components: 99.8001 % Two independent redundant copies: 99.9999 %
The first calculation converts the unavailable fraction into minutes. The second models two required components: both must work, so their independent availabilities multiply, producing 99.8001%.
Redundant copies provide alternatives: either copy can serve the operation. Under independence and perfect switching between them, both must fail for service to fail. That model produces 99.9999%.
These are models, not deployment guarantees. Shared databases, shared failures and the time needed to switch to a healthy copy can invalidate the simple redundancy calculation. See Microsoft's guidance on defining reliability targets.
The mistake to avoid. Do not treat an infrastructure provider’s availability promise as your application’s SLO. Include every dependency required for the customer operation.
In an interview, say: “p99 shows slow requests that an average hides, so I’d measure it end to end. Time-based 99.99% availability allows about 4.3 unavailable minutes in 30 days. Independent required components multiply availability; independent redundant copies can improve it.”
How do rough estimates guide a system design?
User counts are not request rates. You need an assumption about activity before converting users into requests per second.
Suppose the interviewer accepts one million daily active users, ten API requests per active user per day, and a peak ten times the daily average. Assume 90% reads and 10% writes.
Before running this program, guess whether average demand is closer to 100 or 10,000 requests per second:
using System;
using System.Globalization;
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
double dailyActiveUsers = 1_000_000;
double requestsPerUserPerDay = 10;
double averageRequestsPerSecond =
dailyActiveUsers * requestsPerUserPerDay / 86_400;
double peakRequestsPerSecond = averageRequestsPerSecond * 10;
Console.WriteLine($"Average requests/second: {averageRequestsPerSecond:F1}");
Console.WriteLine($"Assumed peak requests/second: {peakRequestsPerSecond:F1}");
Console.WriteLine($"Peak reads/second: {peakRequestsPerSecond * 0.9:F1}");
Console.WriteLine($"Peak writes/second: {peakRequestsPerSecond * 0.1:F1}");Average requests/second: 115.7 Assumed peak requests/second: 1157.4 Peak reads/second: 1041.7 Peak writes/second: 115.7
Multiplication gives ten million requests per day.
Use these numbers to choose what to investigate. Read-heavy demand suggests checking query performance before redesigning writes. Not every write creates an order: some update carts or statuses. Assume 100,000 new orders a day. Separately estimate retained data: at an assumed 2 KB each, those orders need roughly 200 MB daily, before indexes and other storage overhead.
Do not conclude that “two servers are enough.” That needs measurements with representative requests, data and dependencies. Microsoft's capacity-planning guidance supports treating capacity as planning work, not a guess at a machine count.
Continue with back-of-the-envelope estimation when you want more practice.
The mistake to avoid. Do not present an assumed peak multiplier as measured traffic. Explain which design choice would change if that assumption were wrong.
In an interview, say: “I’ll estimate requests from active users and activity, then separate average demand, peaks, reads and writes. These estimates guide choices; representative load tests determine actual capacity.”
How do you turn requirements into a simple .NET design?
Sketch the main API operations and data before choosing hosting products.
For the shop, start with POST /orders and GET /orders/{id}. Store orders and order lines, including the price agreed at purchase. Identify where stock is checked and changed.
Then draw the smallest complete design:
flowchart TD
C["Customer application"] -->|"sends HTTP requests"| A["ASP.NET Core order service"]
A -->|"reads and writes"| D["SQL database"]
The customer calls one logical service, which owns the order operations and uses SQL for storage.
“One logical service” does not mean one running process. You can run multiple instances of the same service for capacity and availability.
Choose components because a requirement calls for them:
| Requirement or evidence | Candidate | Cost or limitation to discuss |
|---|---|---|
| A straightforward order API | ASP.NET Core hosted on Azure App Service | Still needs capacity testing and operational planning |
| Related order records and transactional updates | SQL, potentially Azure SQL Database | Query design and concurrent updates still matter |
| Work must continue after the HTTP request ends | A message queue and a worker, potentially Azure Service Bus | Requires handling delayed and repeated work |
| A part needs independent ownership or deployment | A separate service | Adds network calls and operational work |
A message queue lets the API pass work to a worker, which performs that work outside the customer’s request.
Suppose confirmation emails must be sent after the order request ends. That requirement justifies adding a queue and a worker:
flowchart TD
A["Order API"] -->|"saves order"| D["SQL database"]
A -->|"queues email work"| Q["Message queue"]
Q -->|"passes email work"| W["Email worker"]
The API saves the order and queues email work; the worker sends the email separately. We still need to handle a failure between saving the order and queuing its email, as discussed in the next section.
Microservices divide an application into services that can be developed, tested and deployed independently. They are not the default prize for a large user count.
Usually, start with one logical service and a database if they meet the requirements. Split when evidence supports separate scaling, failure isolation, ownership or deployment. Failure isolation means limiting how far a failure can spread.
Compare architecture styles before selecting one. Microsoft's .NET microservices guide is useful when independent services are actually justified.
The mistake to avoid. Do not add a service because you recognise its Azure name. Every box should answer a requirement and introduce an acknowledged cost.
In an interview, say: “I’d usually start with one logical service and a database, possibly with redundant instances. I’d split for demonstrated scaling, isolation, ownership or deployment needs, accepting the extra network and operational complexity.”
Which failure cases should you discuss in depth?
Choose one or two boundaries where correctness is hardest. A boundary is a point where work crosses between independently failing parts, such as your API and a payment provider.
For the shop, two useful discussions are competing purchases and uncertain payment outcomes.
Competing purchases. Two requests can both read “one item left.” Reading first and updating later is not enough. Propose a database transaction with a conditional stock update that succeeds only when sufficient stock remains:
UPDATE Stock SET Quantity = Quantity - @n WHERE ProductId = @id AND Quantity >= @n
The database checks and reduces stock as one change. This is an atomic conditional update: another buyer cannot slip between the check and the reduction. For an existing product and a positive requested quantity, 0 affected rows means “not enough stock.” Check that result before confirming the purchase.
Uncertain payment outcomes. Treat a payment timeout as an unknown outcome. Propose a stable operation key, stored outcomes and a provider-supported way to recognise repeated payment attempts.
This stable key is usually called an idempotency key: the client sends the same key on every retry, and the service returns the stored result instead of charging again. Limit retries rather than repeating forever. Reconciling means later comparing your stored payment records with the provider's records and fixing any mismatch.
This small program models a provider that remembers payment results by key:
var outcomes = new Dictionary<string, string>();
int charges = 0;
string Charge(string key)
{
if (outcomes.TryGetValue(key, out string result))
return result;
charges++;
outcomes[key] = "Paid";
return outcomes[key];
}
try
{
Charge("order-123");
throw new TimeoutException("Simulated lost response");
}
catch (TimeoutException)
{
Console.WriteLine("Caller sees an unknown outcome");
}
Console.WriteLine($"Retry result: {Charge("order-123")}");
Console.WriteLine($"Charges recorded: {charges}");Caller sees an unknown outcome Retry result: Paid Charges recorded: 1
In this example, a simulated timeout occurs after the charge is recorded. Retrying with the same key returns the stored result, so this example records one charge. This dictionary illustrates the idea; it is not a complete payment implementation.
Also ask what happens if the process stops after saving an order but before sending its message. The outbox pattern saves a pending message in the same database transaction as the business change, then sends it later. Sending can still repeat, so the receiver needs duplicate handling.
These are questions to explore, not claims that one mechanism solves every failure. Continue with idempotency and the outbox pattern.
The mistake to avoid. Do not say “we retry on failure” without distinguishing a confirmed rejection from an unknown outcome. Repeating an operation can repeat its business effect.
In an interview, say: “I’d prevent overselling with an atomic conditional stock update and check the affected-row count. For payments, I’d use an idempotency key and treat a timeout as an unknown outcome. I’d use an outbox for reliable messages, accepting delayed delivery and handling duplicates at the receiver.”
What should you validate before adding more components?
Use the final minutes to prioritise evidence, not enlarge the diagram.
Look for shared dependencies behind apparently redundant services. For example, check whether both order-service instances require the same database to place an order.
For the shop, propose this validation order:
- Monitor end-to-end latency, failures and business outcomes, including stuck orders.
- Run representative load tests with realistic data, traffic mix and dependency behaviour.
- Test interruptions, slow payments and recovery, not only successful requests.
- Check hosting, database, storage and operational costs.
- Name the next change and the evidence that would trigger it.
For example: “If measurements show database queries dominate lookup latency, I’ll investigate those queries before splitting the service.”
Microsoft's performance-testing guidance recommends realistic workflows and using test results to guide changes. Use the Well-Architected Framework to review reliability, security, cost, operations and performance together.
The mistake to avoid. Do not answer “with more time” by listing more products. Name the uncertainty you would reduce first.
In an interview, say: “With more time, I’d review trade-offs, unresolved risks and shared dependencies. I’d prioritise monitoring, representative load and failure tests, and cost checks, then make the next design change based on evidence.”
Check yourself
An interviewer says the shop has one million registered users. What should you do before estimating peak requests per second?
Show answer
Correct answer: C
Registered users do not determine request rate. You need activity and peak assumptions before calculating demand.
A payment request times out after the provider may have accepted it. What is the safest design direction?
Show answer
Correct answer: C
A timeout leaves the result uncertain. A stable identity and outcome checking help avoid charging again for the same intended payment.
Going deeper
Do not add component p99 values and call the result the operation’s p99. Different requests may be slow in different components. Component time budgets help investigation, but the end-to-end percentile still needs measurement.
Availability also does not tell you how much data recovery may lose. A recovery point objective, or RPO, states the acceptable amount of data loss expressed as time. A recovery time objective, or RTO, states the target time to restore service after disruption. Ask about both before promising a recovery design. Microsoft's recovery-target guidance covers RPO and RTO.
Finally, distinguish an SLO from a service-level agreement, or SLA. An SLA is a promise in a contract with customers, often with penalties such as service credits if it is missed. It is usually looser than your internal SLO, and you must read what it covers and excludes. Adding a second region does not automatically satisfy either. You still need a workable recovery procedure, acceptable data behaviour and tests showing that recovery meets the agreed targets.
Sources
- Architecture Styles - Azure Architecture Center | Microsoft Learn: Selecting architecture from requirements; independent services, their benefits and their complexity; a simple service and optional queued processing.
- Azure Well-Architected Framework - Microsoft Azure Well-Architected Framework | Microsoft Learn: Reviewing reliability, security, cost optimization, operational excellence and performance together.
- .NET Microservices. Architecture for Containerized .NET Applications - .NET | Microsoft Learn: Microservices as independently developed, tested, deployed and versioned services.
- Architecture Strategies for Performance Testing - Microsoft Azure Well-Architected Framework | Microsoft Learn: Representative workflows, realistic dependencies, measurable acceptance criteria and evidence-led performance changes.
- Architecture strategies for defining reliability targets - Microsoft Azure Well-Architected Framework | Microsoft Learn: Latency, availability, SLO scope, customer-critical dependencies, recovery targets and multiregion trade-offs. Availability arithmetic is also demonstrated by the console example.
- Architecture strategies for capacity planning - Microsoft Azure Well-Architected Framework | Microsoft Learn: Further reading on planning capacity from demand rather than promising an untested server count.
- Transactional Outbox pattern with Azure Cosmos DB - Azure Architecture Center | Microsoft Learn: Saving business changes and pending messages together before publishing messages separately.
Practice
Checked before publishing: C# examples run on .NET 10, links opened, reviewed while it was written and read in full. How lessons are checked
Updated 28 Nov 2026 ·