What a microservice is in practice, and the concrete costs of turning in-process calls into network calls: latency, partial failure, no shared transaction, versioning, deployment and observability.
A microservice is a small, independently deployable service that owns one business capability and its data. When a method call becomes a network call, four things change: it is ~1,000Γ slower (milliseconds, not nanoseconds), it can fail partially (a timeout tells you nothing about whether the work happened), there is no shared transaction with your data, and the method signature becomes a public contract you must version. On top of that you take on pipelines, tracing, service discovery and on-call per service. The trade-off: you buy independent deployment and team autonomy and pay for it with distributed systems complexity, so it is only worth it when those benefits are real.
"A microservice is a service that owns one business capability and its own data, and that a team can deploy without coordinating with anyone else. The moment I move code out of the monolith, a method call like
_pricing.GetPrice(sku)becomes anHttpClientor gRPC call, and that changes four things for me as a developer.First, latency: an in-process call is nanoseconds, a call inside one Azure region is one to five milliseconds, so a loop that called the method 200 times now costs a second. Second, partial failure: the call can time out, and a timeout doesn't tell me whether the other side did the work, so I need timeouts, bounded retries and idempotency. Third, I lose the shared database transaction: if I save an order and the pricing service records a reservation, those can no longer commit together, so I need eventual consistency, the outbox pattern or a saga. Fourth, the signature is now a public contract: I can't rename a field and fix all callers in one commit, because other teams deploy on their own schedule.
The mistake I see is teams splitting code into services but keeping the habits of a monolith: chatty calls, a shared database, and deploying everything together. Then you pay all the costs and get none of the benefits. My one-line summary: a microservice turns a compile-time dependency into a runtime dependency, and you should only make that trade when independent deployment is worth more than the complexity."
| Concern | Method call in the monolith | Call to another service |
|---|---|---|
| Latency | ~1β50 ns | ~1β5 ms in-region, 10β30 ms cross-region (Australia East β Southeast) |
| Failure | Exception, or it worked | Exception, timeout (unknown outcome), slow response, wrong version |
| Transactions | One DbContext.SaveChanges |
No shared transaction: outbox, saga, compensation |
| Contract change | Rename, compiler fixes callers | Versioning, tolerant readers, deprecation period |
| Debugging | One stack trace | Distributed trace across processes (OpenTelemetry, Application Insights) |
| Deployment | One pipeline | One pipeline per service, plus compatibility between versions |
| Security | In-process | Service-to-service auth (managed identity, mTLS) |
| Benefit | Real only when⦠|
|---|---|
| Independent deployment | Teams actually release on different cadences |
| Independent scaling | One part has very different load (e.g. search vs admin) |
| Fault isolation | Calls are asynchronous or have fallbacks; a sync chain fails together |
| Technology freedom | You accept the cost of supporting several stacks |
| Team autonomy | Each service has one owning team |
In those cases a modular monolith gives you the boundaries without the network.
A checkout page that called a pricing module 40 times per basket in-process (~0.2 ms total) went to ~180 ms p95 after pricing became a separate service, because each call was a 4β5 ms round trip. Replacing the loop with one batch endpoint (POST /prices:batch) brought it back to ~12 ms, and adding a 2-second timeout with a cached fallback stopped pricing outages taking checkout down.
Checks that the candidate understands microservices as a trade-off with concrete costs, not as a default good.
Green flags
Red flags
The definition that matters in interviews has three parts:
Size is not the point. A service with 50,000 lines that one team owns and deploys alone is a fine microservice.
Monolith Microservices
-------- -------------
CheckoutController Checkout service
| GetPrice(sku) ~20 ns | HTTP GET /prices/{sku}
v | DNS -> TCP/TLS (pooled) -> serialise
PricingService v ~1-5 ms, may time out
| Pricing service
v |
Same DbContext / transaction v
Its own database
Every arrow on the right can fail independently: DNS, the connection, the other process, its database, or the reply on the way back.
Checkout Pricing
| --- reserve(sku) ---> |
| | writes reservation, commits
| X reply lost |
| (timeout after 2 s) |
| Did it work? Unknown.
So the caller must either retry with an idempotency key the callee de-duplicates on, or query the outcome. This is the single biggest mindset change.
In the monolith, SaveChangesAsync commits the order and the reservation atomically. Across services there is no shared transaction (distributed two-phase commit is avoided in the cloud). Typical replacements:
OrderPlaced message in one local transaction, publish later.Once another team calls you, every response field is a promise. Rules that follow:
Per service you now need: a pipeline, container image, configuration and secrets, health checks, dashboards, alerts, an on-call owner, and distributed tracing so a request can be followed across services. .NET helps with Microsoft.Extensions.Http.Resilience (timeouts, retries, circuit breakers), Microsoft.Extensions.ServiceDiscovery and OpenTelemetry, but the work doesn't disappear.
HttpClient call to a local Minimal API. Note the ratio.await Task.Delay(3000) in the callee and a 1-second HttpClient.Timeout in the caller. Check whether the callee still finished its work.The same price lookup, before and after the split. Note what the remote version has to add.
namespace Checkout;
// Before: in-process. Fast, atomic, compiler-checked.
public interface IPricing
{
decimal GetPrice(string sku);
}
// After: a remote call. Everything below exists only because of the network.
public sealed record PriceDto(string Sku, decimal Amount, string Currency);
public sealed class PricingClient(HttpClient http)
{
public async Task<IReadOnlyList<PriceDto>> GetPricesAsync(
IReadOnlyCollection<string> skus, CancellationToken ct)
{
// One batch call instead of N single calls: each round trip costs milliseconds.
using var response = await http.PostAsJsonAsync("/prices:batch", skus, ct);
response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync<List<PriceDto>>(ct) ?? [];
}
}
// Program.cs: timeouts, retries and circuit breaker come from Microsoft.Extensions.Http.Resilience,
// and the base address comes from service discovery instead of a hard-coded URL.
builder.Services.AddServiceDiscovery();
builder.Services.AddHttpClient<PricingClient>(c => c.BaseAddress = new Uri("https+http://pricing"))
.AddServiceDiscovery()
.AddStandardResilienceHandler(); // total timeout, retry with jitter, circuit breaker
HttpClient calls beyond the 100-second default. Why it is wrong: a slow dependency ties up requests and threads. Instead: explicit timeouts via the resilience handler.The honest framing is that microservices are an organisational tool more than a technical one: they let several teams deploy independently. If you have one team, you mostly get the costs. A strong candidate states the price in concrete terms (latency per hop, unknown outcomes, no shared transaction, contract versioning) and names the cheaper alternative.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| Monolith | One team, early product | Coupled releases as it grows | Many teams blocking each other |
| Modular monolith | Clear modules, 1β4 teams | Discipline to keep boundaries | Parts need very different scaling or release cadence |
| Microservices | Several teams, stable boundaries, platform support | Network, ops, consistency, versioning | Boundaries unclear, no platform or observability |
Measure before and after: deployment frequency per team, lead time, p95 latency of user journeys, and change failure rate.
Partial failure means part of a distributed system fails while the rest keeps running, and no single node can see the whole picture. The sharpest example is a timeout: when your call to the payments service times out, the request might have been lost, the service might have crashed before or after charging the card, the response might have been lost, or it might still be running. A timeout means the outcome is unknown, not that it failed. So calling code must be written for the unknown: make the operation idempotent (or send an idempotency key) so a retry can't do the work twice, or look up the outcome by a client-generated id before retrying, and run reconciliation for anything left in doubt. The trade-off is extra design work on every write that crosses the network.
A modular monolith is one deployable split into modules aligned to business capabilities β Orders, Billing, Catalogue β each with hard boundaries.
DbContext, no cross-module joins or foreign keys.internal.internal types, architecture tests, even per-schema database permissions.You get microservice-style boundaries with monolith-style operations: one pipeline, in-process calls, easy refactoring. The trade-off: one runtime, one release and one scaling unit, and it only works if the boundaries are enforced β otherwise it decays into a big ball of mud.
Microservices are small, independently deployable services, each owning one business capability and its own data, talking over the network via APIs or messages.
They fit when you have several teams, stable boundaries and mature DevOps. Otherwise a modular monolith gives most of the benefits for a fraction of the cost. The worst outcome is a distributed monolith: all the cost, none of the independence.
Last updated 23 Nov 2026.