Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Microservices and load balancer?

I'm fairly new to the realm of microservices but know basics about load balancing. I recently read an article about the microservices: Enough with the microservices.

There it's mentioned that both the microservices and load balancers have clusters/different VM's for deploying many copies of application but in the case of microservices, we have a separate database in contrast to load balancers which backs a single database. Is it the only difference between them?

Here's the quoted text:

"multiple copies of the same microservice can be deployed in order to achieve a form of scalability. However, most companies that adopt microservices too early will use the same storage subsystem (most often a database) to back all of their microservices. What that means is that you don’t really have horizontal scalability for your application, only for your service. If this is the scalability method you plan to use, why not just deploy more copies of your monolith behind a load balancer? You’ll accomplish the same goal with less complexity."

like image 584
GorvGoyl Avatar asked Sep 24 '26 22:09

GorvGoyl


1 Answers

You can not compare Micro-services with load balancer... you should compare it with monolithic or SOA architecture.

In monolithic approach you mainly have only one database for the whole system and a monolithic application as a single project for your business.

monolithic is single unit But SOA is a coarse-grain approach and Microservice is fine-grain approach. In microservice architecture instead of designing a monolithic system you design different micro-services around your business capabilities and base on your domain and bounded-context.

each micro-services may have their own database. for e.g. order micro-service may have mysql database, recommendation micro-service may have Cassandra database and user-search micro service may have Elasticsearch or SOLR database.

In microservices each micro-service can talk to another base on two different communication style:

  1. Sync (Rest is suggested)
  2. Async (via message brokers like Kafka, RabbitMQ, ActiveMQ or NATS and etc.)

Scaling up-down in micro-services architecture is much easier than monolithic systems and you can even change a part of system and redeploy it independently without affecting the whole system.

Also micro-services adhere to let-it-crash paradigm and with using EIP patterns like Circuit-Breaker you can let user think system is always up and working and Base on CAP theorem you can have high-available system by compensating for consistency and having Eventual Consistency according to BASE instead of ACID

For load balancing Client-side Load Balancing with Ribbon devised by Netflix is very viable approach.

Also with using NginX, Docker Swarm and kubernetes you can implement load balancing.

In a nutshell there is nothing to do about comparing Microservices with Load balancer.

like image 190
Touraj Ebrahimi Avatar answered Sep 28 '26 21:09

Touraj Ebrahimi