Video in progress
Should each service handle retry, timeout, mTLS and observability with a library, or do you hand them to a service mesh? How do you decide?
With one language and a small number of services, a library (Spring + Resilience4j + OpenTelemetry) is cheaper and easier to understand. With many languages, hundreds of services and a mandatory uniform security policy, a mesh pays off, but it brings its own operational load.
📖 Answer
The library approach: each service configures the circuit breaker, retry and trace propagation in its own code. Everything is in plain view, debugging is easy, and there's no extra hop. But with 40 services you get 40 different configurations and different library versions, and a service in Go or Python does everything in a completely different way. It's hard to enforce a security policy (say, "all internal traffic uses mTLS").
A mesh (Istio, Linkerd and others): a proxy next to every pod (or at the node level). Traffic policy is handed out from the center: mTLS is automatic, retries and timeouts are declarative, and metrics look the same everywhere.
The costs:
- Latency: two extra hops through the proxies on every call. Usually under a millisecond, but it adds up in deep chains;
- Resources: thousands of sidecars eat memory and CPU; ambient/sidecarless modes try to reduce this;
- Operational complexity: the mesh itself becomes a critical part of the system. One incident involving its control plane can hit every service. The team needs people who know it deeply;
- Two layers of retry: if both the app and the mesh retry, requests multiply. You need to write down clearly whose job it is.
The decision criteria I use:
- the number of services and the variety of languages;
- security and compliance requirements (zero-trust, audit);
- whether there's a platform team: you can't hand a mesh to a product team as an extra task "in the middle of the work".
In many cases the path is: first standardize with a shared library or starter (an internal "platform BOM"), and move to a mesh only when mTLS or a multi-language environment is a real problem.
Sign up to mark studied questions and save your progress.