TestForge | Aidevops | 📊 Plogger ✍️ Blog 📚 Docs
plogger

AI DevOps Korea

Turn AI service development and operations into one improvement loop

Aidevops.kr covers LLMOps, RAG, agents, observability, evaluation, and cost-performance optimization for production AI services.

Core MSA Patterns: API Gateway, Circuit Breaker, and Event-Driven Design

· Updated Apr 21
Core MSA Patterns: API Gateway, Circuit Breaker, and Event-Driven Design diagram
Visual guide to the key flow, architecture, and decision points covered in this post.
Microservices are not an architecture upgrade by default. They are a cost trade. The real question is not whether MSA is modern, but whether the organization gains enough deployment independence, ownership clarity, and scaling flexibility to justify distributed-system overhead.

That is why good microservice discussions start with organizational and operational boundaries, not with service counts.

The First Decision Is Whether You Need Distribution At All

Many teams adopt microservices because they want:

  • faster deployments
  • clearer team ownership
  • independent scaling
  • better fault isolation

Those are valid goals, but they do not automatically require service boundaries. A modular monolith often solves the same problems more cheaply until the system or organization reaches real pressure.

MSA tends to be justified when:

  • several domains change at materially different speeds
  • teams need deployment independence
  • workloads scale differently enough that one runtime shape is inefficient
  • domain coupling has been identified clearly rather than assumed

Without those conditions, MSA often creates more latency, more operational burden, and weaker local reasoning.

Service Boundaries Must Follow Business Boundaries

The most common microservice mistake is slicing by technical layer or by team guesswork rather than by domain responsibility.

Healthy boundaries usually have:

  • clear ownership over a business capability
  • their own data authority
  • a reason to change independently
  • explicit contracts with other services

Unhealthy boundaries often look like this:

  • one service per CRUD resource
  • shared database tables across services
  • “utility services” with no stable business meaning
  • boundaries drawn mainly to make the architecture diagram look decomposed

The biggest hidden cost in MSA is not networking. It is poorly chosen boundaries.

API Gateways Are Policy Boundaries, Not Just Routers

An API gateway becomes useful when it centralizes edge concerns consistently:

  • authentication and authorization
  • rate limiting
  • request shaping
  • public-versus-internal contract separation
  • cross-service aggregation for client simplicity

It becomes harmful when it turns into a second monolith:

  • embedding business rules that belong inside domain services
  • orchestrating too many internal workflows
  • becoming a hidden dependency graph nobody can reason about

A healthy gateway is an edge policy layer. It is not the place where core business logic quietly relocates.

Synchronous Calls Create Failure Coupling

The more request paths depend on synchronous service chains, the more your system inherits:

  • latency amplification
  • timeout propagation
  • retry storms
  • harder incident diagnosis

This is where many teams discover that distributed systems fail differently from monoliths. Local code may remain simple while overall behavior becomes harder to predict.

That does not make synchronous calls wrong. It means they must be used with discipline:

  • keep chains short
  • bound timeouts
  • make retry ownership explicit
  • use bulkheads and circuit breakers where dependency instability matters

Microservices become expensive when teams mistake network calls for local function calls.

Event-Driven Design Helps, but Changes the Consistency Model

Async messaging is often introduced to reduce synchronous coupling, and that can be the right move. But the trade changes:

  • latency coupling gets weaker
  • temporal decoupling improves
  • failure handling becomes more distributed
  • consistency becomes eventual rather than immediate

This is why patterns such as Outbox, Inbox, idempotent consumers, Saga, and compensating actions matter so much. Event-driven design is not “more scalable REST.” It is a different operational model.

The real question is whether the business process can tolerate asynchronous truth propagation.

Data Ownership Is the Hard Rule

One of the few nearly universal MSA rules is this: each service should own its own persistence boundary.

Once services share tables or mutate one another’s storage directly:

  • deployment independence weakens
  • schema changes become coupled
  • debugging ownership becomes unclear
  • the architecture keeps the cost of MSA without gaining its main benefit

Integration should happen through contracts, events, or APIs, not through hidden database entanglement.

Example: A Healthier Order Flow

client
  -> api gateway
  -> order service
       -> payment service (sync, bounded timeout)
       -> publish order-created event
            -> inventory service consumes
            -> notification service consumes

This kind of flow makes the tradeoffs visible:

  • the payment call is synchronous because user-facing confirmation needs it
  • downstream side effects are async because they do not need to block the user path
  • the gateway stays at the edge instead of owning the workflow

The value is not that the flow is distributed. The value is that the reasons for distribution are explicit.

Observability Is Not a Nice-to-Have

Microservices without strong observability degrade faster than most teams expect.

At minimum, teams need:

  • request tracing across service boundaries
  • structured logs with correlation IDs
  • dependency latency metrics
  • queue and retry visibility for async paths
  • ownership of SLOs per service boundary

Without these, incident handling becomes guesswork very quickly.

Common MSA Anti-Patterns

  • adopting services before domain boundaries are mature
  • using gateways as orchestration engines
  • sharing databases across services
  • turning every interaction into synchronous RPC
  • introducing events without idempotency or replay discipline

These mistakes are common because they preserve short-term convenience while quietly destroying the benefits MSA was supposed to provide.

Review Checklist

  • Does each service own a real business capability?
  • Are sync calls used where immediate consistency is truly required?
  • Is async messaging chosen with explicit consistency consequences in mind?
  • Does each service own its own data boundary?
  • Can incidents be traced across sync and async flows?

Closing Judgment

Good microservice architecture is not about having more services. It is about choosing where independence is worth distributed cost. MSA succeeds when boundaries match business reality, failure modes are designed intentionally, and observability is treated as foundational rather than optional.

Continue Reading

Related posts

Next Path

Keep exploring this topic as a system