Sidecar

The first thing that comes to mind when we say the word sidecar is a pilot on a motorbike who has their co-pilot in a small capsule attached to the motorbike itself.

The same kind of suggestion can be applied to software. Suppose you have an application with a component attached to it. However, in software context, the sidecar is a component that can be plugged and unplugged from the main application, because it must be isolated and cannot impact the application in case it starts misbehaving. This will be something that's collateral to the application. The most used scenarios for a sidecar are monitoring, logging, metrics, and so on.

A sidecar container should be configurable so that it can be plugged into any application—it doesn't have to be just a single application, either. The best match for sidecars are containers. The application container can be bolted to the sidecar container and run as container groups, which are called pods in the Kubernetes and OpenShift worlds.

For decades, one of the main implementations of the sidecar pattern involved an agent, like an agent monitoring application memory, health checks, and CPU usage.

Nowadays, the most popular sidecar implementation is Istio, which deploys a proxy as a sidecar for your service. All of the requests for the service go to the proxy—the Envoy proxy, which uses its configuration to set a policy for how and when the requests should reach your service.

The diagram for Envoy proxy is shown as follows:

With Istio, taking control of the service, and thus of your service mesh, is very easy. Any capabilities such as traffic monitoring, access control, discovery, security, resiliency, tracing, circuit breakers, routing, load balancing, fault injection, retries, timeouts, mirroring, and rate limiting can be added without touching the original application, regardless of the runtime environment and the programming language it is implemented with.

In the end, the sidecar pattern is very helpful, but has a little overhead in terms of implementation. If you are running a small piece of software, adding a sidecar might be too much, and a bit too complex.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset