Load Balancing Pattern

What is it?

A load balancer will act as a single point of entry.

It will then distribute messages to workers via message distribution strategy.

This allows the source to not care about which worker it wants to talk to since it only talks to a single point.

An auto scaler can be used hand in hand with a load balancer, to create more workers when load becomes high.

This can work for n-tier patterns too.

Implementations

Cloud Load Balancing Service

Simply use the load balancing service provided by you cloud provider.

Consider that this can work well for multiple availability zones, since the cloud provider will manage this for you.

Message Distribution Approaches

Message Broker

A message broker is NOT A LOAD BALANCER.

But they do share similar properties.

The worker can request for a new message after completing a task.

By the very nature of this, load will be distributed evenly.

Also using a message broker, no response can be given to the source, thus this is uni-directional.

This can only be use for internal services too.