Architecture

Service Mesh

Understanding service mesh for microservices communication.

3 min readConcepts · System Design

What is a Service Mesh?

A Service Mesh is a dedicated infrastructure layer that handles service-to-service communication. It manages traffic, security, and observability without changing application code.


Without vs With Service Mesh


Architecture

Sidecar Pattern

Every service instance gets a sidecar proxy. All traffic flows through the proxy.

Data Plane vs Control Plane

ComponentRole
Data PlaneSidecar proxies handling actual traffic
Control PlaneManages proxy configuration and policies

Key Features

FeatureDescription
Traffic managementLoad balancing, routing, canary deployments
SecuritymTLS, authorization policies
ObservabilityMetrics, tracing, logging
ResilienceRetries, timeouts, circuit breaking
Rate limitingControl request rates between services

Traffic Management

Canary Deployment

A/B Testing


Security: Mutual TLS

All service-to-service traffic is encrypted and authenticated automatically.


MeshProxyNotes
IstioEnvoyMost popular, feature-rich
Linkerdlinkerd2-proxyLightweight, Rust-based
Consul ConnectEnvoy / built-inHashiCorp ecosystem
AWS App MeshEnvoyAWS-managed

Service Mesh vs API Gateway

AspectAPI GatewayService Mesh
ScopeNorth-south (external → internal)East-west (internal → internal)
PositionEdge of networkBetween all services
FocusExternal API managementInternal service communication
AuthAPI keys, OAuthmTLS, RBAC

When to Use

Good fit:

  • Many microservices (50+)
  • Need consistent security policies
  • Complex traffic routing requirements
  • Polyglot services (different languages)

Avoid when:

  • Few services (< 10)
  • Monolithic architecture
  • Team unfamiliar with Kubernetes
  • Latency is extremely critical

Trade-offs

ProsCons
Zero code changes for cross-cutting concernsAdded latency (proxy hop)
Consistent security (mTLS everywhere)Operational complexity
Rich observability out of the boxResource overhead (sidecar per pod)
Language-agnosticSteep learning curve

Interview Tips

  • Explain sidecar proxy pattern
  • Distinguish data plane vs control plane
  • Compare with API gateway (north-south vs east-west)
  • Discuss mTLS for zero-trust networking
  • Know when to use (many services) vs when to avoid (simple setups)

Finished reading?

Mark it done to track your progress in Concepts.