Introduction to Load Balancers

Just a guy who loves to write code and watch anime.
Search for a command to run...

Just a guy who loves to write code and watch anime.
Today I've learned you can scale load balancers, and balance load on load balancers😂
Qualities that make outstanding builders.

Bipedal vs quadrupedal: how many legs This is about the number of legs the creature walks on. Bipedal. Two legs. Humans, ostriches, T-rex, kangaroos, most fantasy humanoids. Quadrupedal. Four legs. Do

Intro You hear "lerp" and "smoothstep" everywhere in game dev. They sound like math jargon. They're not. Both are small tools that do the same job: smoothly move from one value to another. The problem

What is Kinematics Kinematics is the math field. It's the study of how things move without worrying about forces (which would be dynamics). FK and IK are the two branches: forward kinematics and inver

Intro Textures are usually the biggest cost in a 3D scene. Memory, bandwidth, and load time all get eaten by them. Resizing them is the obvious lever. There's more. This post is about the less obvious

Load balancers are important parts that help control web traffic and make sure applications stay available and work well. They are one of the core pieces in system design.
Imagine a scenario where a single server is connected to multiple clients. As more clients make requests, the server struggles to keep up, leading to slow response times or even crashes due to overload. This is where load balancing comes into play.

To address this, we can scale the system in two ways:
Vertical Scaling: Adding more power (CPU, RAM) to the existing server.
Horizontal Scaling: Adding more servers to distribute the workload.
Horizontal scaling is often favored for its flexibility and scalability. However, with multiple servers, we face a new challenge: how to distribute incoming client requests efficiently across all servers. This distribution is the primary function of a load balancer.
A load balancer acts as an intermediary between clients and servers, directing incoming requests to the least busy server. It ensures no single server becomes a bottleneck, improving the application's overall performance and reliability.

In essence, load balancers can be seen as a type of reverse proxy, but with the added ability to manage traffic across several servers.
When a new server is added to the system, the load balancer's configuration is updated to include this server in the distribution process.
Load balancers use various algorithms to distribute traffic, such as:
Round Robin: Cycles through a list of servers, sending each new request to the next server.
Least Connections: Directs traffic to the server with the fewest active connections.
IP Hash: Determines the server based on the IP address of the client, ensuring a client always reaches the same server. This can help with caching.
What if the load balancer itself becomes a bottleneck?
To prevent this, you can scale load balancers horizontally by adding more load balancers.
DNS load balancing is another technique where DNS is used to distribute requests across multiple load balancers, further enhancing the system's scalability and reliability.

Load balancers are importance in modern web systems as they distribute traffic evenly, preventing server overloads and enhancing performance and reliability.
Using load balancers well helps businesses make sure their apps stay easy to grow, strong, and always ready for users.