Junior — Middle
What role does a load balancer play when using Docker, and what tasks does it solve?
sobes.tech AI
Answer from AI
The load balancer when using Docker acts as a distributor of incoming requests among multiple containers or services running in a cluster. Its tasks:
- Ensure even distribution of load so that no container is overwhelmed.
- Increase fault tolerance: if one container crashes, the load balancer redirects traffic to others.
- Provide scalability by allowing containers to be added or removed without interruption.
For example, in Docker Swarm, the built-in load balancer automatically distributes requests among service replicas.