by BehindJava

What is Side Car Pattern in the Microservices

Home » microservices » What is Side Car Pattern in the Microservices

In this tutorial, we are going to learn about the Side Car Pattern in the Microservices.

Side Car Pattern

  • The Side car pattern is used for resiliency, cleaner design and implementation of microservices.
  • Deploying the components of an application or service into a separate process or container to provide isolation and encapsulation.

To understand this better, let’s look at this example.

  • We have a microservice in the yellow box and a Side car microservice in the green box as shown below. scp
  • So all the core functionalities and main functionalities are in the microservice itself and auxiliary functionalities such as logging, configuration, proxy to remote services are inside the sidecar microservice.
  • Now the ask is this, that all the core functionalities should work without any problems.
  • So, for example, if logging breaks or if configuration raises an exception in the program. We don’t want the code in the actual microservices to break, and that is why we separate the processes.
  • So if the process of sidecar breaks for any fault, then the actual microservices can still run and continue working and another benefit is you can have one sidecar microservices that is used by more than one microservice.
  • So instead of repeating the code for logging and configuration on all microservices, we can have it in a sidecar microservice so that other microservices use those services via this sidecar microservices.