Microservices Architecture and Service Decomposition Questions
Decomposing a system into services along bounded contexts, defining service boundaries and ownership, and managing the tradeoffs against a monolith. Covers cohesion, coupling, data ownership per service, the distributed-monolith anti-pattern, and when a modular monolith beats microservices. Emphasizes decomposition reasoning rather than any single framework.
Explain the architectural principles loose coupling, high cohesion, separation of concerns, and single responsibility as they apply to drawing service boundaries. For each principle, give a concrete example of a boundary decision it would push you toward, and explain how violating it shows up later (harder deployments, blurred ownership, cascading changes).
Sample Answer
Direct answer
Loose coupling means two components can change independently without breaking each other; high cohesion means everything inside one component is closely related and serves one clear purpose. Separation of concerns and single responsibility are the design habits that get you there: separation of concerns keeps distinct kinds of logic (say, business rules versus data storage versus presentation) from tangling together, and single responsibility says each unit (a service, a class, a module) should have one reason to change.
Structured elaboration
At the service-boundary level, loose coupling shows up as: Service A can deploy a new version without Service B needing to change or even redeploy, as long as A's external contract (its API) stays the same. High cohesion shows up as: everything Service A does relates to one clear responsibility (an Order service handles order lifecycle, not also user authentication and email formatting). Violating loose coupling typically looks like two services sharing a database table directly, so a schema change in one silently breaks the other; violating high cohesion typically looks like a "God service" that has accumulated unrelated responsibilities over time because it was the easiest place to add one more feature.
Concretely: if Service A calls Service B synchronously and depends on B's internal implementation details (say, the exact error codes B's database driver happens to return) rather than B's documented API contract, that's tight coupling, because a change B makes to its internals, even one that doesn't change its documented behavior, can break A. The fix is depending only on the contract, not the implementation, and versioning that contract explicitly when it does need to change.
Worked example
Single responsibility applied to service boundaries: an Order service that also sends marketing emails when an order ships has taken on a second responsibility unrelated to order-lifecycle management; a change to the email template now requires redeploying and retesting the Order service, and a bug in the email-sending code can take down order processing even though the two are logically unrelated. Splitting email notifications into their own service (triggered by an OrderShipped event rather than embedded in the Order service's code) restores single responsibility: each service has one reason to change, and a failure in one doesn't take down the other.
Trade-offs and pitfalls
Violating these principles rarely happens all at once; it's usually death by a thousand small compromises, each individually reasonable ("it's faster to just add this one field to the existing service instead of creating a new one") that accumulate into a service nobody wants to touch because it has too many unrelated responsibilities and too many hidden dependents. The counter-pressure is real too: splitting too aggressively in the name of single responsibility produces services so narrow that every business operation requires coordinating five of them, trading one kind of complexity (a tangled service) for another (an over-fragmented one); the goal is a boundary that's cohesive enough to reason about on its own and loosely coupled enough to change independently, not maximal fragmentation.
Design a governance model for an enterprise with hundreds of microservice teams. Describe the standards, the platform-team's role and what it provides (service discovery, gateway, tracing, CI/CD, shared libraries), onboarding flow for a new service, technical guardrails, and an API/service catalog, in a way that preserves developer autonomy while keeping the landscape's operational complexity manageable as it grows.
Sample Answer
Direct answer
A governance model for hundreds of microservice teams needs four elements working together: clear technical standards (so services are consistent enough to operate), a platform team providing the shared tooling that makes following those standards the path of least resistance, a low-friction onboarding flow for spinning up a new service correctly by default, and an API/service catalog that makes the whole landscape discoverable rather than tribal knowledge.
Structured elaboration
Standards define what "good" looks like across the fleet: a baseline for observability (every service emits the same core set of metrics and traces), a baseline for how services are deployed (a common deployment pipeline pattern), and a baseline for API design and versioning, so that a caller doesn't have to relearn conventions for every new service it talks to. The platform team provides the shared tooling every product team builds on: service discovery, an API gateway, a tracing backend, standard CI/CD pipeline templates, shared libraries for common concerns, and infrastructure-as-code modules that make provisioning a new service's infrastructure consistent by default rather than something each team figures out independently. Onboarding flow determines whether standards actually get followed in practice: if creating a new, standards-compliant service is faster and easier than cutting corners (a service template that already wires up the standard observability, deployment, and auth patterns), most teams will follow the path of least resistance and end up compliant without needing to be told to; if the compliant path is slower than the shortcut, teams will take the shortcut. A service catalog gives every team (and any auditor, or anyone debugging a cross-service issue) a single place to see what services exist, who owns them, what they depend on, and what their current API contract looks like, which is what makes escalation paths for a cross-cutting problem (who do I even talk to about this) actually work in an org too large for tribal knowledge to cover.
Worked example
A new service, at creation time, starts from a template maintained by the platform team that already includes standard observability instrumentation, a working CI/CD pipeline, and the org's standard auth pattern wired in; the team building the service registers it in the catalog as part of that same creation flow (not as a separate, easily-skipped step), and its API contract is published there automatically as part of the deployment pipeline, so the catalog stays accurate without relying on someone remembering to update documentation by hand.
Trade-offs and pitfalls
The most common governance failure is defining standards without investing in the tooling that makes them easy to follow, which produces a gap between the documented standard and what teams under deadline pressure actually ship; standards that aren't backed by a genuinely easier compliant path tend to be honored mostly in the breach. The second common failure is a service catalog that isn't automatically kept in sync with reality (populated by hand, and quickly going stale), which makes it actively misleading rather than merely incomplete; wiring catalog registration and API-contract publication into the deployment pipeline itself, so it updates automatically, is what keeps it trustworthy at scale.
You are responsible for migrating a large, high-traffic monolith to microservices with a target of zero customer-visible downtime and high availability throughout. Outline an architecture and migration plan: how you prioritize which modules to extract first, the decomposition strategy, data migration approach, cutover and canarying, rollback plan, and the success metrics you'd track. Call out how you'd keep changes to existing API consumers minimal during the transition, and any risk the migration carries given limited existing test coverage.
Sample Answer
Direct answer
For an org-scale, zero-downtime migration of a large monolith, the plan sequences the extraction by risk and dependency order (lowest-risk, most self-contained modules first), uses the strangler pattern with change-data-capture or dual-write-with-reconciliation for data migration, cuts over gradually with canarying at each step, and tracks explicit success metrics (error rate, latency, and a defined rollback trigger) rather than treating "the migration shipped" as the finish line.
Structured elaboration
Decomposition strategy at this scale starts by mapping the monolith's modules against the same four signals used for any split-or-not decision (change frequency, team ownership, scaling difference, blast radius), and prioritizing the modules where those signals most strongly agree, rather than starting with the module that's technically easiest to extract but delivers the least value. Data migration for a module with tightly-coupled database tables generally needs either change-data-capture (streaming the monolith's writes to the new service without the new service writing back to the old tables) or dual-write with a reconciliation job comparing the two stores until they're confirmed in sync, since a big-bang data cutover on a live, high-traffic table is one of the highest-risk moments in a migration like this. Cutover and canarying follow the same gradual-rollout discipline as a single-module extraction, just repeated and coordinated across however many modules are in flight at once, with each module's canary period run independently so a problem in one doesn't block or contaminate the others. Rollback planning means keeping the old code path intact and routable-to for each module until its canary period has run long enough (and covered enough real traffic patterns, including any periodic spikes) to build confidence, and defining upfront what error-rate or latency regression triggers an automatic rollback rather than deciding that under incident pressure.
For a monolith with genuinely minimal existing test coverage, the migration plan needs an extra step before extraction: characterization tests that pin down the CURRENT behavior of the module being extracted (including its undocumented quirks), so the new service can be verified against what the system actually does today, not just what it was originally intended to do; skipping this step on a poorly-tested legacy module is how migrations quietly change behavior that some downstream caller was silently depending on.
Worked example
Success metrics to track through the migration: error rate and P99 latency for each migrated module, compared before and after cutover; the percentage of traffic still routing to the monolith versus the new services, tracked over time to show real progress; and the number of rollbacks triggered, which (counterintuitively) is a healthy sign early in a migration program, since it means the rollback mechanism actually works when needed, rather than a sign the migration is failing. Keep client-facing API contracts stable through the transition wherever possible, since callers, whether internal teams or external partners, shouldn't need to change their integration just because the implementation moved from the monolith to a new service.
Trade-offs and pitfalls
The biggest risk specific to org-scale migrations (as opposed to a single-module extraction) is running too many modules through cutover simultaneously, which multiplies the number of things that could go wrong at once and makes it hard to attribute a production issue to the specific migration step that caused it; sequencing extractions so that at most a small number are in an active cutover window at any time keeps incidents attributable and rollbacks targeted.
Behavioral: describe a time you participated in an incremental migration or large refactor in production, such as extracting a service from a monolith. Outline the objective, the incremental steps you proposed, how you minimized user impact, the testing and monitoring you put in place, how you measured success, and what you would do differently in hindsight.
Sample Answer
Direct answer
Behavioral answer skeleton: describe a real incremental migration or large refactor (extracting a service from a monolith is a natural example), the specific staged approach taken to minimize user impact, the testing and monitoring that gave confidence at each stage, how success was measured, and one honest thing that would be done differently with hindsight.
Structured elaboration
A strong answer names the objective concretely (what was being migrated and why, in a sentence or two, not a vague "we modernized our architecture"), then walks through the incremental steps actually taken: how the work was sliced into stages small enough to ship and verify independently, rather than as one large, high-risk cutover. The user-impact-minimization piece should be specific: a canary rollout to a small percentage of traffic first, feature-flagging the new path so it could be turned off instantly if something went wrong, or scheduling the highest-risk step during a low-traffic window. Testing and monitoring should name what was actually watched (error rates, latency, a specific business metric that would flag a regression) rather than a generic "we tested it thoroughly." Success measurement should be a real number or outcome the candidate can speak to concretely (deploy frequency for the migrated piece went up, or a specific class of incident stopped recurring), and the hindsight reflection should be a genuine, specific lesson (something that was underestimated, or a step that, in retrospect, should have been smaller or better instrumented), not a soft non-answer like "communication could always be better."
Worked example
A representative version of this story: extracting a reporting module from a monolith because its long-running queries were periodically degrading the monolith's main request path. The staged approach: first, the new reporting service ran in parallel reading from a read replica (not the primary database), verified against the old reporting output for several weeks before anyone relied on it, then a feature flag switched a small internal team over first, followed by a gradual rollout to the rest of the org, with the old reporting code path kept alive as a fallback the whole time. Monitoring watched query latency on the primary database (the original problem) and a diff between old and new reporting outputs during the parallel-run period. Success was measured by the primary database's query latency returning to baseline once reporting traffic moved off it, and by the absence of any reported discrepancy in the parallel-run comparison. The hindsight lesson: the parallel-run comparison period was cut short by a week under schedule pressure, and a data discrepancy that surfaced shortly after full rollout would likely have been caught during a longer comparison window; with hindsight, that comparison period should have been held to its original length regardless of the schedule pressure.
Trade-offs and pitfalls
A behavioral answer to this question fails when it stays at the level of "we followed best practices" without a specific staged plan, a specific thing that was monitored, or a specific, non-generic lesson learned; interviewers are listening for evidence the candidate actually owned the risk-reduction decisions (why this stage, why this rollout order) rather than reciting the general shape of a migration.
Explain how Domain-Driven Design concepts like bounded contexts, aggregates, and ubiquitous language influence microservice boundaries. Give an example mapping DDD concepts to services for a payments-and-billing domain, and name one mistake architects commonly make when they equate every code module to its own microservice.
Sample Answer
Direct answer
A bounded context is a boundary within which a specific business concept has one precise, consistent meaning; the same word can mean different things in different contexts (an "order" means a customer purchase in the Sales context and a warehouse picking task in the Fulfillment context), and a bounded context is the boundary that keeps those meanings from colliding. It's the natural starting point for drawing service boundaries because a coherent bounded context is already a low-coupling, internally-consistent unit of the domain.
Structured elaboration
A bounded context is defined by its ubiquitous language, the shared vocabulary that a team and its stakeholders use consistently within that boundary; when the same term needs different definitions depending on who's using it, that's usually the signal that you're looking at two contexts, not one. Within a context, an aggregate is the consistency boundary for a single business transaction (for example, an Order aggregate that enforces its own invariants, like "an order's total must match the sum of its line items," as a single atomic unit), and aggregates are the building blocks a bounded context is made of.
For a payments-and-billing domain, a Payments bounded context might own the concepts of a transaction, an authorization, and a settlement, each with its own aggregate and its own precise meaning of terms like "amount" (post-fees or pre-fees, for example); a Billing bounded context might separately own the concept of an invoice and a subscription, where "amount" means something contractual rather than transactional. Even though both contexts touch money, mapping them to two separate services (rather than one "Money" service) follows directly from the fact that their ubiquitous languages and consistency boundaries genuinely differ.
Worked example
The common mistake architects make is equating every code module or every noun in the domain to its own microservice, treating "Bounded Context = Service" as a mechanical, one-to-one rule rather than a starting point for judgment. A bounded context is a good place to START looking for a service boundary because it's already internally coherent, but a very small, tightly-related pair of bounded contexts (say, Authorization and Settlement within Payments, if they share the same team, the same consistency requirements, and change together) can reasonably stay in one service, while a genuinely large bounded context might still need to be split further along a different axis (like read/write access patterns) once it's grown large enough.
Trade-offs and pitfalls
The risk of treating bounded contexts too literally as service boundaries is producing more services than the org can operate well, each one technically "correct" by the Domain-Driven Design (DDD) definition but not justified by any real difference in scaling, ownership, or release cadence. The opposite risk, ignoring bounded contexts entirely and drawing service boundaries along purely technical or organizational lines, tends to produce services whose internal data model is internally inconsistent, because two different meanings of the same term (like "order") end up living in the same service without a clear boundary between them.
Unlock Full Question Bank
Get access to all 34 Microservices Architecture and Service Decomposition interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.