Microservices Design pattern: Sidecar

Part 2 of microservices design patterns

Microservices Design pattern: Sidecar

As we move monolithic applications to microservices or develop microservices for new requirements, the suite of services keeps growing. There are multiple requirements that are common to each of these services such as configuration management, monitoring, log aggregation, service discovery, and network access.

These features although mandatory do not constitute the core business logic of the application. It seems easy to create these integrations within each such service, the problem arises to manage them or replace them.

SideCar.png

Drawbacks of building everything within a service

  • They will be tightly coupled with the application code, making them very difficult to change.

  • For changing values, a fresh deployment of mission-critical applications might be required.

  • A fault in one of the nonfunctional attributes may lead to application failure.

So what alternative do we have?

How about if we are able to plug these features out of the box, an excellent example of this is Istio. It mediates inbound and outbound communication to the workload instance it is attached to. This is a sidecar pattern.

What is a sidecar pattern?

The sidecar pattern is a single-node(pod) pattern that has two containers. The first is the application container. It contains the core business logic for the application. In addition to the application container, there is a sidecar container. The role of the sidecar is to augment the application container.

SideCar1.png

The application container is unaware of the features of this side container.

Benefits of sidecar pattern

  • Enables the application container to concentrate on the core business logic without worrying about additional requirements.
  • Reduces boilerplate and repetitive code with the application.
  • Easy swap between different service patterns or vendors for these requirements.

Use cases of sidecar pattern

- Log Aggregation systems that collect data from multiple services.

SideCar_Log.png

- Service discovery and network call management.

image.png

- Configuration management.

Config_Sidecar.png

- Health check services and Performance monitoring tool integration

HealthCheck (1).png

If you like this article, please support by following me, liking it.. You can follow me on Twitter where I tweet on development, architecture, and best practices and processes.

Follow me : Twitter | LinkedIn