{}DSA Atlas

Microservices & Infrastructure

Monolith vs modular monolith vs microservices, service boundaries with domain-driven design, synchronous vs asynchronous communication, API gateway and BFF, service discovery, service mesh and sidecars, containers and Kubernetes essentials, serverless, deployment strategies (blue-green, canary, feature flags), configuration, and data ownership.

Intermediate → Advanced7 interview questions

Architectural styles

Monolith tangled modulesone DB, one deploy Modular monolith orders billing catalog users Microservices orders+ DB billing+ DB catalog+ DB users+ DB simplicity ←————————————————→ independent deploy & scale (and distributed-systems tax)
A modular monolith with enforced boundaries is the best default; extract services when there's pressure.
MonolithMicroservices
Deployone artifactindependent per service
Scalingwhole appper service
Datashared DB, ACIDDB per service, eventual consistency
Failureone bug can take down allisolation (if designed for it)
Latencyin-process callsnetwork hops
Debuggingstack tracesdistributed tracing
Team fitsmall teamsmany autonomous teams

Communication

StyleExamplesUse when
Sync request/responseREST, gRPCcaller needs the answer now (queries, validations)
Async commandsqueue (SQS, RabbitMQ)work to be done by exactly one service
Async eventsKafka, SNSbroadcast facts; consumers decide what to do

Avoid long synchronous chains (A → B → C → D): availabilities multiply (0.999⁴ ≈ 0.996) and latencies add. Prefer async events and local read models (CQRS) for data you need from other services.

The infrastructure around services

web mobile partners API gatewayauthN · limits Kubernetes cluster + mesh orders+ sidecar payments+ sidecar catalog+ sidecar users+ sidecar Kafka DBs per service cache mesh control plane: mTLS certs · routing · policies CI/CD · GitOps (Argo CD) · registry observability: metrics (Prometheus) · logs (Loki/ELK) · traces (OpenTelemetry → Tempo/Jaeger)
The platform: gateway at the edge, mesh between services, async backbone, and shared observability.

Service mesh vs library

ConcernLibrary (Resilience4j, gRPC interceptors)Mesh (Istio, Linkerd)
Languagesper languageany
Upgradesredeploy every serviceplatform team upgrades proxies
mTLSmanualautomatic
Overheadnone extraproxy hop, CPU/memory

Containers and Kubernetes

Containers package an app with its dependencies, isolated via Linux namespaces (pid, net, mount, user) and limited via cgroups (CPU, memory) — see OS: processes. Images are layered and immutable.

YAML
apiVersion: apps/v1
kind: Deployment
metadata: { name: orders }
spec:
  replicas: 3
  strategy: { type: RollingUpdate, rollingUpdate: { maxUnavailable: 0, maxSurge: 1 } }
  selector: { matchLabels: { app: orders } }
  template:
    metadata: { labels: { app: orders } }
    spec:
      containers:
        - name: orders
          image: registry.example.com/orders:1.42.0
          ports: [{ containerPort: 8080 }]
          resources:
            requests: { cpu: "250m", memory: "256Mi" }
            limits: { memory: "512Mi" }
          readinessProbe: { httpGet: { path: /ready, port: 8080 }, periodSeconds: 5 }
          livenessProbe: { httpGet: { path: /live, port: 8080 }, periodSeconds: 10 }
---
apiVersion: v1
kind: Service
metadata: { name: orders }
spec:
  selector: { app: orders }
  ports: [{ port: 80, targetPort: 8080 }]

Serverless

ProsCons
no servers, scale to zero, pay per usecold starts (ms–seconds)
automatic scalingexecution time and memory limits
great for event glue, spiky workloadsconnection storms to databases (use proxies)
vendor lock-in, harder local testing

Good for webhooks, image processing triggered by uploads, cron jobs, low-traffic APIs. Less good for latency-critical steady high traffic (containers are cheaper there).

Deployment strategies

Blue-green blue v1 (idle) green v2 100% flip the router; flip back to roll back Canary v1 — 95% v2 5% compare metrics; ramp 5 → 25 → 100% both require backward-compatible DB migrations (expand → migrate → contract)
Decouple deploy from release; make rollback boring.

Expand/contract migration for renaming a column: add new column → write both → backfill → read new → stop writing old → drop old. Each step is a separate deploy.

Twelve-factor essentials

Config in environment, stateless processes, backing services as attached resources, logs as event streams, disposability (fast start, graceful shutdown on SIGTERM — drain connections), dev/prod parity, one codebase per service.

Interview questions

0 / 7 marked confident

Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.