Microservices Patterns/Foundations & Cloud Primitives

Monolith vs Microservices Trade-offs

Independent deployability vs operational complexity, Conway's Law, shared libraries vs shared databases, and interview framing for "why not a monolith?"

3/5Overview: 30m

Monolith advantages (staff engineers still defend these)

  • Simple deployment — one artifact, one rollback
  • Refactoring — IDE finds all callers; no cross-repo versioning
  • Transactions — local ACID, no sagas
  • Debugging — single process trace, no distributed tracing required
  • Latency — in-process calls, no network

Fowler's MonolithFirst: prove domain model in monolith; extract when pain justifies ops tax.

Microservices advantages

  • Independent deploy — ship payments without retesting catalog
  • Independent scale — scale hot services only
  • Technology diversity — Go for ingest, Java for ledger (use sparingly)
  • Fault isolation — blast radius containment (if truly decoupled)
  • Team autonomy — Conway's Law: architecture mirrors communication structure

Costs you must articulate in interviews

CostManifestation
OperationalN deploy pipelines, N on-call rotations
ObservabilityDistributed tracing mandatory (Observability track)
ConsistencySagas, idempotency, outbox (Distributed Systems)
LatencyNetwork + serialization on every hop
TestingContract tests, staging env complexity
DataNo cross-service JOINs; denormalized read models

Conway's Law

Organizations design systems that mirror their communication structures.

If teams are organized by layer (all DBAs, all frontend), you'll get layer services. Stream-aligned teams (vertical slice) produce capability services.

Shared libraries vs shared runtime

  • OK: thin client SDK, auth middleware, observability bootstrap
  • Risky: shared domain model JAR coupling all services to one release train
  • Never: shared database schema across services

Modular monolith (middle path)

Single deploy, module boundaries enforced by compiler/package rules (Java modules, Go packages, Nx boundaries). Extract to services when module API is stable.

Popular at senior startups before 50+ engineers.

When interviewer asks "microservices or monolith?"

Answer structure:

  1. Team size and org structure
  2. Deploy independence need
  3. Scale heterogeneity
  4. Operational maturity (K8s, mesh, observability in place?)
  5. Default monolith/modular monolith unless clear pain

Further Reading

Hands-On Tasks (Optional)

Architecture drills and whiteboard exercises. Assumes Communication & Data Transfer and Distributed Systems fundamentals.

  • Argue against microservices

    For a 10-engineer startup shipping weekly: list 5 concrete costs of microservices (deploy, debug, data consistency, latency, hiring) and when you'd revisit the decision.

    15m