Co-locate a cohesive set of tasks with the primary application, but place them inside their own process or container, providing a homogeneous interface for platform services across languages.
A sidecar service is not necessarily part of the application, but is connected to it. It goes wherever the parent application goes. Sidecars are supporting processes or services that are deployed with the primary application.
Advantages of using a sidecar pattern include:
-
independent from its primary application in terms of runtime environment and programming language, so you don't need to develop one sidecar per language.
-
can access the same resources as the primary application. For eg, monitor system resources used by both.
-
Because of its nearness to the primary application, there’s no significant latency when communicating.
-
Even for applications that don’t provide an extensibility mechanism, you can use a sidecar to extend functionality by attaching it as own process in the same host or sub-container as the primary application.
The sidecar pattern is often used with containers and referred to as a sidecar container or sidekick container.
