What is a service mesh? (original) (raw)

A service mesh is a dedicated infrastructure layer that controls service-to-service communication within a distributed application. This method enables separate parts of an application to communicate with each other. Service meshes appear commonly in concert with cloud-native applications, containers and microservices.

A service mesh controls the delivery of service requests in an application. Common functions provided by a service mesh include service discovery, load balancing, encryption and failure recovery. High availability is also common through the use of software controlled by application programming interfaces (APIs) rather than through hardware. Service meshes can make service-to-service communication fast, reliable and secure.

An organization can choose an API gateway that handles protocol transactions instead of a service mesh. However, developers must update the API gateway every time a microservice is added or removed. Service meshes typically offer network management scalability and flexibility that exceed the capabilities of traditional API gateways.

How a service mesh works

A service mesh enhances the manageability, observability and security of microservices-based applications. It uses proxy-based communication where the proxies are built into an application. These proxies act as intermediaries between microservices and an organization's network and route all traffic to and from the service via its proxy server. This maximizes the efficiency of all interconnected elements.

Typically, a service mesh architecture consists of a data plane and a control plane.

Data plane

The data plane handles the data part of a service mesh. It's composed of various services running alongside individual proxy instances known as sidecars or sidecar proxies. Sidecars can handle tasks abstracted from the service itself, such as monitoring and security. In a microservices application, a sidecar attaches to each service. In a container, the sidecar attaches to each application container, virtual machine (VM) or container orchestration unit, such as a Kubernetes pod. Service instances, sidecars and their interactions make up the data plane in a service mesh.

To prevent service degradation, sidecar proxies integrate resiliency features, such as circuit breaking -- a design pattern for microservices -- and request retries to enable direct service-to-service communication.

Control plane

The control plane manages tasks such as creating instances and monitoring and executing policies for network management and security. It defines routing rules and policies for traffic management, such as load balancing and security policies, including access control and encryption settings.

Control planes can connect to a command-line interface or a graphical user interface for application management.

A diagram showing how a service mesh works.

Web services typically interact through APIs (left), but a service mesh architecture (right) separates those communications from the application logic and manages them through the control plane and a proxy or sidecar.

Why adopt a service mesh?

An application structured in a microservices architecture might comprise dozens or hundreds of services, all with their own instances that operate in a live environment. It's challenging for developers to keep track of which components must interact, monitor their health and performance, and make changes to a service or component if something goes wrong.

A service mesh enables developers to separate and manage service-to-service communication in a dedicated infrastructure layer. As the number of microservices involved with an application increases, so do the benefits of using a service mesh to manage and monitor them.

Key features of a service mesh

A service mesh framework typically provides many use cases that make containerized and microservices communications more reliable, secure and observable. Service mesh features include the following:

Service mesh benefits and drawbacks

A service mesh addresses some but not all issues with managing service-to-service communication. It also offers various benefits when used with microservices.

A service mesh offers the following advantages:

Downsides to service mesh include the following:

Service mesh vs. API gateway

Although a service mesh and an API gateway have a lot in common, they differ in how they operate. Main differences between a service mesh and an API gateway include the following.

Service mesh

API gateway

The service mesh market

There are numerous commercial and open source service mesh options available. Some are open source or are based in part on open source technology; others are tied to other service mesh platforms. Many are available as software as a service (SaaS) products. The major cloud providers and Kubernetes platform providers offer packaged and hosted service mesh products. The following is an alphabetical list of several providers of service mesh products and services:

A service mesh provides significant advantages for large-scale microservices architectures, but it isn't always ideal for simpler systems due to its complexity and steep learning curve. Consider the reasons why a service mesh might not be the best fit for certain scenarios.

This was last updated in August 2024

Continue Reading About What is a service mesh?

Dig Deeper on Containers and virtualization