Skip to content

Checking your reading list…

Retry verification

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

Service Mesh Deep Dive: Control/Data Plane Separation, Sidecar & xDS Protocol
Cloud Native 20 min read

Service Mesh Deep Dive: Control/Data Plane Separation, Sidecar & xDS Protocol

This article explains Service Mesh architecture, detailing the control plane and data plane separation, Sidecar deployment pattern with iptables traffic interception, xDS protocol for dynamic configuration, and core capabilities including traffic management, zero-trust mTLS security, and automated observability via metrics, logs, and distributed tracing.

Service Mesh serves as a critical infrastructure layer in microservice architectures, decoupling service-to-service communication complexities — service discovery, load balancing, traffic control, security, and observability — from business logic and pushing them down to the platform layer, significantly simplifying distributed system development and operations.

1. Core Architecture: Control Plane and Data Plane

Service Mesh follows the cloud-native separation-of-concerns principle, extracting non-functional cross-cutting concerns from core business code and delegating them to dedicated Sidecar proxies. The architecture comprises two main parts:

Control Plane : Does not handle actual data traffic. Instead, it manages and configures all proxies in the data plane, distributing configurations, security policies, and service discovery information. It exposes APIs for operators to define routing rules and security policies, then dynamically pushes these to data-plane proxies via the xDS protocol, enabling hot updates without application restarts. For example, Istio's istiod integrates configuration management and certificate issuance, using xDS to push rules in real time.

Data Plane : Consists of lightweight Sidecar proxies deployed alongside each service instance, forming a distributed network that processes all traffic. Every inbound/outbound request is transparently intercepted by the Sidecar, which executes policies received from the control plane — load balancing, circuit breaking, retries, mTLS encryption, and telemetry collection.

Advantages of this separation:

Decoupling and abstraction : Data plane handles real-time traffic with high performance demands; control plane handles configuration with high consistency demands. They can evolve independently.

Centralized management : Operators interact only with the control plane to globally configure and monitor the entire mesh.

Dynamism : Control plane reacts to system changes (deployments, scaling, failures) and updates data-plane configuration instantly.

Selection guidance: Envoy dominates the data plane with high-performance L4/L7 proxying, rich filter plugins, and an active community; Istio offers the most complete traffic governance but consumes more resources; Linkerd is lightweight and simple, suitable for resource-sensitive or smaller-scale scenarios.

Service Mesh architecture diagram
Service Mesh architecture diagram

1.1 Data Plane

The data plane directly processes and forwards network traffic. It consists of lightweight network proxies deployed next to each microservice instance, intercepting all TCP traffic entering or leaving that instance. The industry-standard data-plane proxy is Envoy, originally developed by Lyft and donated to CNCF.

Core responsibilities:

Traffic interception and forwarding : Transparently intercepts inbound/outbound traffic and performs intelligent routing per control-plane rules.

Service discovery and load balancing : Maintains a local registry of upstream service instances and distributes outbound requests using algorithms such as round-robin, least connections, random, weighted, and session affinity (request-hash based).

Traffic policy enforcement : Implements fine-grained controls — request routing (by path, header, cookie), traffic splitting (canary releases), timeouts, retries, circuit breaking.

Security policy enforcement : Handles service-to-service authentication (mTLS handshake), authorization (allow/deny per access policy), and encryption/decryption.

Telemetry collection : Generates detailed metrics (latency, throughput, success rate) and distributed tracing spans for each request, forwarding them to monitoring systems.

1.2 Control Plane

The control plane does not process business traffic; it manages and configures all data-plane proxies, pushing policies and configurations so they operate cohesively. Core responsibilities:

Configuration center : Provides unified APIs for operators to define high-level traffic rules, security policies, and observability policies.

Service discovery : Integrates with underlying infrastructure (e.g., Kubernetes API Server) to discover all services and endpoints.

Policy translation and distribution : Translates user-defined high-level policies into low-level proxy configurations.

Configuration distribution : Pushes translated configurations dynamically to all relevant proxies via standardized APIs such as Envoy's xDS protocol.

Certificate management : Acts as a certificate authority (CA), issuing identity certificates to every workload in the mesh and managing rotation, enabling data-plane mTLS.

The control and data planes communicate via the xDS (Discovery Service) protocol , pioneered and standardized by the Envoy project, which has become the de facto standard.

1.3 Sidecar Pattern

The Sidecar pattern is the most widely adopted deployment model for the Service Mesh data plane. The proxy runs as a separate container (Sidecar) in the same Pod or VM as the business application, sharing the network namespace so the Sidecar communicates with the application over localhost.

Sidecar pattern illustration
Sidecar pattern illustration

Workflow:

Injection : An automated process modifies the Pod definition at creation time, adding the Sidecar proxy container configuration.

Traffic hijacking : The injection also modifies the Pod's network configuration (typically via iptables rules) to redirect all IP traffic to/from the business container to the Sidecar's designated port.

Proxy processing :

Outbound : When the application initiates a request, iptables intercepts it and forwards to the Sidecar. The Sidecar executes service discovery, load balancing, circuit breaking, retries, then forwards to the target service instance's Sidecar.

Inbound : External requests arriving at the Pod are similarly intercepted by iptables and handed to the Sidecar, which enforces security policies (mTLS decryption, authorization checks), collects telemetry, and finally forwards legitimate requests to the business application listening on localhost.

This process is completely transparent to the business application — the application is unaware of the Sidecar's existence or that its traffic is being intercepted and processed.

1.4 Comparison with Traditional Microservice Architecture

Compared with traditional Spring Cloud approaches:

Service Mesh vs Spring Cloud comparison
Service Mesh vs Spring Cloud comparison

Service Mesh advantages:

Architectural decoupling, focus on business : Service governance is fully separated from business logic; developers focus on business with zero code intrusion.

Polyglot unified governance : Sidecars run as independent processes, providing standardized circuit breaking, routing, and security for services written in any language.

Flexible traffic control and release strategies : Supports canary releases, A/B testing, fault injection, and other advanced traffic management.

Hardened security posture : Automated mTLS establishes a zero-trust service network, significantly improving security.

Comprehensive observability : Native integration of distributed tracing, metrics collection, and log aggregation provides powerful data for troubleshooting and performance analysis.

Trade-offs: Traffic passing through the Sidecar adds 1–3 ms latency and increases CPU/memory consumption. Managing the control plane and all Sidecars demands higher operational expertise, and fault diagnosis becomes more complex.

2. Core Functional Implementation Mechanisms

Service Mesh delivers value primarily through three capabilities: traffic management, security, and observability.

2.1 Traffic Management

1) Service Discovery and Load Balancing

In microservice environments, service instance addresses change dynamically. Service Mesh achieves automated, intelligent discovery and load balancing via control-plane/data-plane collaboration.

Discovery mechanism : Control plane continuously monitors the platform (e.g., Kubernetes API Server) for service registration changes, builds a global real-time view, and pushes endpoint lists to Sidecars via the EDS API, transparently to applications.

Load balancing mechanism : Proxies use local endpoint lists and CDS-delivered policies to select instances at outbound time; supported algorithms include round-robin, least connections, random, weighted, and session affinity (request-hash based).

2) Dynamic Routing and Traffic Splitting

Service Mesh supports fine-grained L7 traffic control, making complex deployment strategies like canary releases, A/B testing, and blue-green deployments straightforward.

Operators submit declarative configuration resources (e.g., Istio's VirtualService and DestinationRule) to the control plane to define routing rules.

Control plane parses these high-level rules and translates them into low-level routing configurations that Envoy understands, pushing them via the RDS API.

Proxies match request attributes against rules to implement canary releases, A/B tests, etc., without application restarts.

3) Circuit Breaking and Retry Mechanisms

Built-in resilience mechanisms improve distributed system robustness and prevent localized failures from cascading into system-wide outages.

Circuit breaker : Monitors calls to a service; when persistent failures are detected, it temporarily "opens" to stop further calls, avoiding wasted resources and giving the failing service a recovery window. Implemented as a state machine (closed → open → half-open → closed), triggered by consecutive error counts or error rates; supports configurable maximum ejection percentage and ejection duration; half-open state probes for recovery.

Retry : Automatically retries transient network blips or brief service unavailability. Configured with conditions (e.g., 5xx), attempt count, per-attempt timeout, and retry predicates; uses exponential backoff plus random jitter to prevent retry storms.

2.2 Security

1) Zero Trust and mTLS

Zero trust's core principle is "never trust, always verify" — no internal communication is trusted by default; all must undergo strict authentication and authorization. Service Mesh automates this via mTLS.

Workload identities based on SPIFFE; control-plane CA automatically issues X.509 certificates, distributed and rotated dynamically via the SDS API.

Sidecars automatically perform mTLS handshakes, mutually verifying certificates and establishing encrypted channels, fully transparent to applications.

2) Fine-Grained Access Control

Operators define authorization policies (e.g., Istio's AuthorizationPolicy) specifying which source services (by SPIFFE identity) may access which target services. The target Sidecar enforces the policy on inbound requests, rejecting non-matching ones with 403.

2.3 Observability

The data plane automatically generates rich telemetry for all service-to-service communication, covering Metrics, Logging, and Tracing .

Metrics : Sidecars automatically produce numerous standardized metrics for all traffic flowing through them, including traffic volume, latency, and error rates.

Logging : Sidecars can generate detailed access logs per request in a uniform format, containing source/destination IP, method, path, protocol, response code, latency, user agent, and more.

Tracing : Distributed tracing tracks a request's complete call chain. Proxies automatically propagate trace context and generate spans, building service-call topology and timing without application instrumentation; backends integrate with Jaeger or Zipkin.

Operators configure observability via the control plane — enabling/disabling specific telemetry collection, adjusting trace sampling rates, defining log formats, etc.

Fundamentally, Service Mesh extracts all service-communication cross-cutting concerns from business code, sinking them into standardized infrastructure to achieve decoupling, unified governance, and enhanced observability. It acts as an abstraction layer atop TCP/IP between services, taking over all inter-service network traffic and uniformly implementing governance capabilities, fully transparent to business applications. Its emergence solves core pain points of traditional microservice governance frameworks (e.g., Spring Cloud, Dubbo SDKs): language lock-in, business-governance coupling, complex SDK upgrades, and inconsistent governance standards across teams.

References:

https://developer.aliyun.com/article/1719152

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

observabilityService MeshTraffic ManagementSidecarControl PlaneData PlanemTLSxDS

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion