View a markdown version of this page

REL03-BP01 Choose how to segment your workload - AWS Well-Architected Framework

REL03-BP01 Choose how to segment your workload

How you divide a workload (segmentation) sets the boundaries for where teams work and where faults are contained. Finer-grained segments improve agility and limit the blast radius of a failure, but they add the complexity of a distributed system. The right level depends on your reliability requirements, your team structure, and how much operational overhead you can absorb.

Desired outcome:

  • Your workload is divided into components whose boundaries match reliability requirements and team ownership.

  • Your components are as loosely coupled and stateless as their function allows, so they scale and recover independently.

  • You choose a segmentation level deliberately, weighing agility and fault isolation against operational and latency costs.

  • Your architecture can evolve toward finer segmentation as adoption grows, without a full rewrite.

Common anti-patterns:

  • Teams build a monolith with no internal modularity, leaving no path to decompose it as the workload grows.

  • Teams split a workload into services so interdependent that one failure cascades across all of them, recreating a monolith's fragility with added complexity.

  • Teams adopt microservices for a product racing to first launch, paying distributed-system costs before they are needed.

  • Teams decompose a monolith without checking whether its components can operate without shared state.

Benefits of establishing this best practice:

  • Finer-grained segments increase agility, organizational flexibility, and scalability because small teams own well-defined pieces.

  • A failure in one component affects a smaller share of the workload, which reduces the impact of service interruptions.

  • Components with different availability requirements can be sized and operated independently.

  • Team responsibilities become clearer because each service maps to a defined boundary.

Level of risk exposed if this best practice is not established: High

Implementation guidance

Segmentation sits on a spectrum. For example:

  • A monolith packages all functionality into one deployable unit.

  • Service-oriented architecture (SOA) divides functionality into coarse services aligned to business functions.

  • Microservices push those boundaries finer, so each service owns a single capability and its data.

Moving along this spectrum trades simplicity for autonomy. Smaller services deploy, scale, and fail on their own, but the workload as a whole becomes a distributed system with associated coordination costs.

The main cost of finer segmentation is distributed computing. Calls that were once in-process become network calls, which adds latency and new failure modes. A single user interaction now spans several services, so debugging is harder. Operating many independently deployed components raises the operational burden. A subtler failure mode is over-decomposition. When services grow so interdependent that one service's failure brings down the others, you have recreated a monolith's fragility while paying the full price of distribution.

A product racing to first launch benefits from the speed of a monolith or a few coarse services, whereas a workload expected to scale from the start justifies finer boundaries early. Statelessness makes fine segmentation practical because components that do not share state respond to demand and recover from faults on their own. When you refactor an existing monolith, assess how well its components tolerate separation before you commit. Even if you begin with a monolith, keep it modular so it can evolve toward SOA or microservices as adoption grows.

Comparison of three architecture styles: a monolithic application that does everything through a shared release pipeline with rigid scaling, a service-oriented architecture of some coupled services surfaced through a communication protocol, and microservices that each do one thing with independent deployment and scaling.

Monolithic, service-oriented, and microservices architectures compared

Several AWS services address the trade-offs of finer segmentation. AWS X-Ray (part of Amazon CloudWatch) traces requests across distributed services, which reduces the debugging cost of many moving parts. Amazon VPC Lattice and AWS Cloud Map let distributed services discover and reach each other. Amazon MQ can act as a service bus when you decouple a legacy application in stages.

Implementation steps

  1. Choose a target architecture: Decide where to place your workload on the segmentation spectrum based on its reliability requirements, team structure, and tolerance for operational overhead. SOA offers smaller segments than a monolith while avoiding some microservices complexity, and microservices offer the finest boundaries and the most autonomy. For the decision criteria, see Microservice trade-offs.

  2. Refactor incrementally with the Strangler Fig pattern: When you decompose an existing monolith, replace specific functions with new services one at a time rather than rewriting everything at once. For a worked approach, see Seamlessly migrate on-premises legacy workloads using a strangler pattern.

  3. Separate shared data along the new boundaries: For a monolith with one shared database, split the data by business unit, access pattern, or data structure so it matches your service boundaries. Decide whether each segment fits a relational or non-relational store. For guidance on that choice, see From SQL to NoSQL.

  4. Add service discovery for distributed components: Distributed services need a way to find and reach each other as they scale and move. Use AWS Cloud Map for dynamic, DNS-based discovery. Amazon VPC Lattice provides service-to-service connectivity with built-in traffic management across VPCs and accounts, and Amazon ECS Service Connect simplifies service discovery and traffic handling for ECS workloads.

  5. Bridge legacy integration during migration: When you move from a monolith to SOA, a managed message broker can decouple components while you redesign them. Amazon MQ can serve as a service bus for applications that use standard messaging protocols.

  6. Instrument distributed tracing: Once requests span multiple services, add tracing so you can follow one interaction across service boundaries and locate latency and failures. Use AWS X-Ray to collect and visualize this data.

Resources

Related best practices:

Related documents:

Related videos:

Related workshops:

Related services: