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 how decomposing a system into smaller, well-bounded services can reduce the blast radius of a failure, compared to a single large service that owns many responsibilities. Give an example where splitting a service reduced an outage's scope and made recovery simpler, and describe the trade-off this introduces: more inter-service calls to reason about.
Sample Answer
Direct answer
Decomposing a large service into smaller, well-bounded ones limits how far a single failure can spread, because a bug, resource exhaustion, or outage confined to one small service only takes down the functionality that service owns, instead of a shared process where the same failure could take down every feature that happened to be bundled into it.
Structured elaboration
Blast radius in a monolithic (or overly broad) service is large because everything runs in the same process, shares the same resource pool (memory, connection pool, thread pool), and typically deploys together; a memory leak or a slow downstream dependency in one code path can exhaust shared resources and degrade or crash the whole service, taking unrelated features down with it. Splitting that broad service into smaller, independently-deployed pieces along genuine bounded contexts means each piece has its own process, its own resource pool, and its own deploy and rollback cycle, so a failure in one is naturally contained to the functionality it owns, and recovering it (restarting it, rolling it back) doesn't require touching or redeploying the unrelated pieces.
Worked example
A service that originally handled both order processing and a resource-intensive report-generation feature in the same process: a runaway report-generation job consuming excessive memory could previously degrade order processing too, since they shared the same process and resource pool. Splitting reporting into its own service means a runaway report job now only affects reporting; order processing, running in a completely separate process with its own resources, is unaffected, and the reporting service alone needs to be restarted or scaled to fix the issue, without any customer-facing order-processing impact.
Trade-offs and pitfalls
The trade-off this introduces is more inter-service communication to reason about: what used to be a function call within one process (order processing needing something from the reporting logic, if it ever did) now potentially becomes a network call, which can fail in ways an in-process call can't (timeouts, partial failures, network partitions), and needs its own error handling. Splitting purely for blast-radius reduction without also handling those new failure modes at the boundary (timeouts, retries, fallback behavior) can trade one class of failure (a shared-process crash) for another (an unhandled network failure cascading anyway, just through an HTTP call instead of a function call); the blast-radius benefit only fully materializes when the new inter-service calls are also built defensively.
How would you quantify and present the technical risk and business cost of having many microservices with overlapping responsibilities, versus consolidating some of them into fewer services? Describe the metrics you would gather (deployment coordination overhead, on-call load, infra cost per service, cross-service change frequency), any lightweight experiments you might run, and how you would present the trade-off to executives who are not engineers.
Sample Answer
Direct answer
To quantify the cost of too many overlapping-responsibility microservices, measure deployment coordination overhead (how often a single logical change requires touching multiple services in lockstep), on-call and incident load per service, infrastructure cost per service (even a nearly-idle service carries a fixed baseline cost), and cross-service change frequency (how often a change to one service requires a corresponding change to another); present the trend in those numbers to executives rather than an architectural opinion about service count.
Structured elaboration
Deployment coordination overhead is measurable directly: track how many recent releases required coordinating changes across two or more services that, if consolidated, would have been a single deploy, and how much calendar time that coordination added compared to a single-service change. On-call load is measurable from incident data: total pages per service per month, and specifically how many of those incidents were caused by an inter-service contract mismatch (a caller and callee disagreeing about a field's meaning or an API version) rather than a genuine bug in one service's own logic, since contract mismatches are a direct symptom of over-decomposition. Infrastructure cost is measurable from the cloud bill: baseline compute, monitoring, and logging cost per service, multiplied by the number of services that could plausibly be consolidated without losing a real scaling or ownership benefit. Cross-service change frequency is measurable from version-control history: how often a pull request in one service's repo is immediately followed by a corresponding pull request in another service's repo within a short window, a proxy for services that are more tightly coupled in practice than their separate deployability suggests.
Worked example
A lightweight experiment to gather this evidence without a large upfront investment: instrument the deploy pipeline to tag any release that required a coordinated multi-service change, and run that for a month before making a consolidation recommendation, rather than relying on anecdotes about "it feels like everything requires touching three services." Present the finding to executives in business terms: "N% of releases in the last quarter required coordinating three or more services, adding an average of X days to the release; consolidating these two specific services would remove that coordination cost for roughly Y% of those releases," rather than a purely technical argument about service-count aesthetics.
Trade-offs and pitfalls
The risk of presenting this case poorly is framing it as "we have too many microservices" in the abstract, which invites a debate about architectural philosophy instead of a decision grounded in measured cost; naming the SPECIFIC services with the worst coordination and incident numbers, and proposing a targeted consolidation of just those, is both more persuasive and less risky than a broad "let's reduce our service count" initiative. The countervailing risk is consolidating services that look similar on paper but actually have a real, measured difference in scaling or team ownership; the same data-gathering discipline that justifies a consolidation should also be used to rule one out when the signals don't actually support it.
Discuss the pros and cons of a monorepo versus multiple repositories when organizing the code for many independently-owned services at a large company. Focus on the impact on CI build times, release cadence, cross-service refactors, and code-ownership boundaries.
Sample Answer
Direct answer
A monorepo (all services' code in one repository) makes cross-service refactors and dependency management easier because everything is visible and changeable atomically in one place, at the cost of CI build times and tooling that need to scale with the size of the whole repository, not just one service; multiple repositories give each service team full independence over its own build and release cadence, at the cost of cross-service changes requiring coordinated, separately-versioned pull requests across several repos.
Structured elaboration
CI impact: a monorepo's CI system needs to be smart enough to build and test only what actually changed (otherwise every commit anywhere in the repo triggers a full-fleet rebuild, which doesn't scale past a modest number of services); this typically requires investment in build-graph-aware tooling that many organizations don't have off the shelf. A polyrepo's CI is naturally scoped to one service per repo, so each build stays fast and simple by default, without needing that investment. Release cadence: a monorepo makes it straightforward to enforce that everyone is always building against the latest version of a shared library (there's only one version in the repo at any time), which prevents version-skew problems but also means a breaking change to a shared library needs to either fix every consumer in the same commit or be rolled out very carefully; a polyrepo lets each service pin its own version of a shared dependency and upgrade on its own schedule, which is more flexible per-team but means version skew (different services depending on different, sometimes old, versions of the same library) becomes a real and recurring problem to track. Cross-service refactors: a monorepo makes a refactor that touches five services a single atomic commit, visible and reviewable as one change; a polyrepo makes the same refactor five separate pull requests across five repos, each independently reviewed and merged, which is harder to keep consistent and harder to roll back as a single unit if something goes wrong.
Worked example
A large company with genuinely independent teams and a strong platform investment in build tooling (build-graph-aware CI, code-ownership enforcement at the directory level) can make a monorepo work well at significant scale, gaining the refactor and dependency-consistency benefits without paying an unbounded CI cost. A company without that tooling investment, or with teams that genuinely want full autonomy over their own release process (including the freedom to lag behind on a shared dependency's latest version while they finish their own migration), is often better served by a polyrepo, accepting the coordination cost of cross-repo changes as the price of that independence.
Trade-offs and pitfalls
The common mistake with a monorepo is adopting it without the CI tooling investment to make it scale, producing painfully slow builds that engineers start working around (skipping tests locally, batching unrelated changes to amortize a slow CI run), which erodes the discipline the monorepo was meant to encourage. The common mistake with a polyrepo is underestimating how much coordination overhead accumulates from routine, small cross-service changes (a shared library security patch, for example, that now needs a separate PR, review, and release in every consuming repo), which can end up costing more engineering time in aggregate than the monorepo's CI investment would have.
A user-profile subsystem for a global application needs to serve a large, latency-sensitive user base. Describe how you would decompose responsibilities across services (for example profile storage, authentication, preferences, avatar/media processing): where you'd draw the boundaries, whether each inter-service call should be synchronous or asynchronous, how you'd isolate one service's failures from the others, and how the owning teams should coordinate their APIs and contracts.
Sample Answer
Direct answer
For a global, latency-sensitive user-profile subsystem, a reasonable decomposition splits Profile Storage, Authentication, Preferences, and Avatar/Media Processing into separate services, each with a clearly different access pattern and failure-isolation need, communicating synchronously only where a request genuinely can't proceed without an immediate answer.
Structured elaboration
Authentication is kept separate because it's a security-sensitive, extremely high-frequency, low-latency dependency that nearly every other request needs to check, and isolating it means an issue in less-critical functionality (like avatar processing) can never take down the ability to authenticate a request. Profile Storage owns the core profile fields (name, settings, account state) and needs to be read on nearly every request, so it's optimized for fast, simple reads, kept narrowly scoped to just that core data rather than accumulating every profile-adjacent feature over time. Preferences (notification settings, UI preferences, and similar lower-stakes, less frequently-read data) is split out specifically because it doesn't need the same latency or availability guarantees as core profile and authentication data; if the Preferences service is slow or briefly unavailable, the rest of the profile experience should still work with sensible defaults, whereas Authentication being unavailable is a much more serious failure. Avatar/media processing is naturally asynchronous (resizing, transcoding, or moderating an uploaded image takes real time and doesn't need to block the rest of the profile experience) and has a very different resource profile (CPU/IO-heavy batch-style work) from the fast, simple reads the other services handle, making it a clear candidate for its own service with its own scaling behavior.
On communication choices: reading a user's core profile (needed on most page loads) should be synchronous, since the caller can't meaningfully proceed without it; updating a display avatar can be asynchronous, since the caller doesn't need to wait for image processing to finish, just for the upload to be accepted. Failure isolation follows from the split: if Avatar Processing is degraded, users can still authenticate, read their profile, and use the rest of the product, with a graceful fallback (a default avatar, or the previous one) rather than the whole profile experience failing.
Worked example
For team coordination across these services: the team owning Authentication needs the strictest change-management discipline given its security sensitivity and blast radius if it breaks, and its API contract with the other three services should be the most stable and carefully versioned of the four; Profile Storage's API needs to stay backward-compatible for the many other services and clients that read from it directly; Preferences and Avatar Processing, being lower-stakes and more independently used, can iterate faster with a lighter review process, as long as their optional, non-blocking nature is preserved (nothing else should come to depend on them synchronously in a way that would undo the isolation benefit).
Trade-offs and pitfalls
The most common mistake in a decomposition like this is letting Profile Storage's scope creep to absorb Preferences or other adjacent data over time ("it's just one more field"), which quietly recreates the coupling the split was meant to avoid; keeping the boundary honest requires treating a new field's home as a deliberate decision (does this need Profile Storage's stricter availability and latency guarantees, or can it live in the more relaxed Preferences service) rather than defaulting to wherever's most convenient to add it.
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.
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.