Why you need it
Every service has its own code for calling the others: its own timeout, its own retries, its own way of showing a certificate. With 50 services, no two match, and changing one rule means changing and releasing 50 programs.
Think of it like this
Clocks in a house. You can set each one by hand, and they drift apart. Or every clock sets itself from one radio signal, and you change the time in one place.
Where you’ll find it
- Istio: Istio puts a proxy beside every service on Kubernetes and sets their rules from one place.
- Linkerd: Linkerd is a smaller mesh built to be simple to run, with mTLS on by default.
- Envoy: Envoy is the proxy inside Istio and many other meshes.
- HashiCorp: Consul adds a mesh for services on plain servers as well as Kubernetes.
What to know first
Timeout. How long a caller waits before giving up. See Timeouts.
Proxy. A small program that passes calls on, and can apply rules on the way. See Reverse proxy and API gateway.
Certificate between services. Each service shows a signed name before any call. See mTLS and zero trust.
How it works
- Rules live in every service. The shop waits 2 seconds for payments; payments waits 30 seconds for something else. Ben changes one, and the other is still different. This is the red pill in the animation.
- A proxy beside each service. Put a small proxy next to each service and let it make the calls. The service just talks to its own proxy, and every call goes from proxy to proxy. This proxy is called a sidecar, because it rides next to the service.
- Write the rule once. Now the timeout is one line, kept in one place, and every proxy gets a copy. Ben changes that line, and every proxy follows. No service is changed or released.
- The same move covers more. Because every call passes a proxy, the same one place can also set retries (see Retries with backoff and jitter), make every proxy show a certificate (mTLS), and count every call's speed and errors. Press the button in the animation to turn on certificates with one more line.
- What it costs. Every call now passes two extra proxies, adding about a millisecond and some memory on every server. And the mesh is one more system to run, upgrade and debug. For a handful of services, a shared library is often enough.
An example
A company has 40 services. To change the timeout to payments from 30 s to 2 s, each team must edit and release: 40 changes over about two weeks.
With a mesh, Ben edits one line. Within a minute all 40 proxies use 2 s.
The price: each call gains roughly 1 ms through the two proxies, and one team now looks after the mesh itself.
Further reading
- What is a service mesh?, Linkerd. A plain explanation from the people who coined the term. Start with this one.
- The Service Mesh: what every engineer needs to know, William Morgan, Buoyant. Why meshes exist, what they cost, and when you do not need one.
- Request timeouts, Istio docs. The exact move in the animation: one timeout set for every proxy.