CTYPE html>Load balancer – It’s okay if you don’t understand, but if you’re an engineer can’t help but understand?

What is a load balancer

? What benefits does a load balancer bring? This phrase is so famous that even first-year students have heard of it, let alone programmers like you. I know many of you in my company still don’t know anything about Load balancer (LB), so I hope that through this article, those of you who don’t know will now confidently answer that they know, after reading this article. this paragraph.

Viewing: What is load balancing

What is a load balancer?

I remember correctly, in the article “10 ways to improve server and user performance” this phrase was mentioned. That’s right, this is a technique or solution design that is indispensable in optimizing large systems with many users, thereby bringing high performance to the user experience.

In early Inte applications and probably decades ago, because of relatively small user traffic and relatively simple business logic, it was common for a single server to handle the load requests. As Internet traffic gets bigger and bigger like the big systems at your company do, the slightly better system gets huge hits and the system functions get more and more complex, so even if performance of a server is optimized (in terms of hardware), it cannot support such a large number. Today, the number of users is very high. So at this point you need to use multiple machines and design a high performance cluster to deal with it.

In short, you are a business owner who transports goods from North to South by truck or something. You have a warehouse in HCM. When foreign goods arrive, you concentrate your goods at Ho Chi Minh warehouse (this includes Hanoi, Da Nang, and HCM). But as mentioned above, you only have a warehouse in HCM, so if your customers want to get it, they can only queue at the warehouse in HCM. You can create a wider queue (hardware server upgrade) but that won’t be enough for your customers to stay. Because… People in HCM are easy, they are nearby and quickly go to pick up the goods. But people in Hanoi or Da Nang take the trouble to move to Ho Chi Minh City to get goods. It costs money, it takes time, so if you don’t set up a mechanism like load balancer, you set up a warehouse in Da Nang, and in Hanoi and from there you distribute it, everything will be solved.

So how is the solution of the load balancer or its algorithm, right now you often watch…

How many architectures does the load balancer have

You notice these are 3 diagrams, not algorithms. There are many different solutions depending on the model of each company. But on the Internet market, there are 3 main types:

Load balancer based on DNS

Load balancer based on hardware Software based load balancer

Slowly don’t be impatient, each has its own strengths and weaknesses but it is impossible to talk about combining these 3 ways that I have built a model for my current company in Germany. We will now go into detail about each of these ways.

READ MORE  Distinguishing Principal & Principle

Load balancer based on DNS

DNS-based load balancer is really one of the simplest implementation options if you have experience in server system administration, by doing a simple configuration on the DNS server. The principle is that when a user visits a domain, it first resolves the IP address corresponding to the domain name for the DNS server. At this point, we can allow the DNS server to return different IPs according to users in different geographical locations. For example, a user in the south returns the IP of our business server in Ho Chi Minh. If users in the north access, I will return the IP of the business server in Hanoi. That’s just an example, but in Vietnam it’s too close together

With the implementation in this way, it helps the user to access the nearest place to get the goods (read the top of the article to understand), which not only reduces the load pressure of a cluster, but also improves the access speed. user access.

The natural advantages of using DNS as a load balancer solution are simple configuration and very low implementation costs with no additional development and maintenance work required. But it also has some disadvantages what is it??? Obviously, if you have ever pointed to DNS, you understand that when the DNS configuration is modified, it will not take effect in time. This is due to the characteristics of DNS. DNS often has many levels of cache, so when we modify the DNS configuration, the cache has not changed in time, leading to the IP not being updated in time, thus affecting the efficiency of the load balancer.

In addition, when using DNS to load balancer, most of them are based on geolocation to figure out where that User is located via IP, there is no more advanced routing strategy, so this is also the limit. mechanism of DNS solution.

Load balancer based on hardware device

Speaking of this, it must be said that the big brother in this distribution village, F5 Networks, is pleased to introduce to you and my brothers and sisters. My boss just a carrier aka F5. You can simply understand something like a network switch, purely through hardware and very good performance. The number of requests that can be processed per second reaches millions of records.

Of course, it’s very expensive, if anyone has used it, please give me a price for reference This type of device is often used at the forefront of the traffic entrance of large Intel companies, as well as the government. Government, state-owned enterprises and other enterprises are not short of money. Small and medium companies in general are not ready to use it because, you know. In addition, there are many benefits such as security, fire ideas of ostrich …

Load balancer Software-based

Software load balancer refers to the use of software to distribute and balance the number of users. The software load balancer is divided into 7 Layer protocol and 4 Layer protocol. The most famous is Nginx. For a more solid concept you should read about this article What Is Layer 7 Load Balancing? Because the author has not gone through this diagram, it is not possible to have a thorough look, so it is left open here.

READ MORE  Useful Information About Sim 097

What are the commonly used balancing algorithms

? After we look at the 3 commonly used architectures currently, we will go through the load balancer algorithms. But stop here I will tell you this. I don’t think I’ll stop here. But I came across an article on “What are Load Balancing Algorithms?” posted on asking.asia, I think I will not be able to explain as fully and clearly as the article that I mentioned. That’s why I borrowed some content and used it here.

Start asking.asia’s post

Depending on the Load Balancing technology, different algorithms will be used to determine whether the server is working or not. The most common types of algorithms are:

Round RobinWeighted Round RobinDynamic Round RobinFastestLeast Connections

Algorithm Load Balancing – What is Round Robin

?Round Robin is an algorithm that selects servers in sequence. Accordingly, the Load Balancer will start going from server number 1 in its list corresponding to the first request. It will then move down the list in order and start again at the top when it reaches the last server.

What are the disadvantages of Load Balancing – Round Robin algorithm?

When there are 2 continuous requests from the user, it can be sent to 2 different servers. This takes time to create more connections with the second server while the first server can also answer the information that the user needs. To get around this, round robin is often installed along with session persistence methods such as the use of cookies.

See more: What is Jailbreak – Should Jailbreak For Iphone, Ipad

What is the Load Balancing – Weighted Round Robin algorithm

?Similar to the Round Robin technique, but WRR is also capable of handling according to the configuration of each destination server. Each server is rated with an integer (weight value – default value is 1). A server with twice the processing capacity of another server will have a larger number and receive twice as many requests from the load balancer.

What are the disadvantages of Load Balancing – Weighted Round Robin algorithm?

Weighted Round Robin causes dynamic load imbalance if the load of requests keeps changing over a large period of time.

What is Load Balancing – Dynamic Round Robin (DRR) algorithm?

The DRR algorithm works almost like the WRR algorithm. The difference is that the weighting here is based on a continuous server check. Hence the weights are constantly changing.

Choosing a server will be based on many aspects in analyzing the server’s performance in real time. For example, the number of connections currently available on the servers or the fastest responding server, etc.

READ MORE  What is Bureaucracy?

This algorithm is not usually implemented in simple balancers. It is commonly used in F5 Network’s load balancing products.

What is the Load Balancing – Fastest algorithm

?This is an algorithm based on calculating the response time of each server (response time). This algorithm will choose the server with the fastest response time. The response time is determined by the time interval between sending a packet to the server and receiving the reply packet.

This sending and receiving will be handled by the load balancer. Based on the response time, the load balancer knows which server to forward the next request to.

The Fastest algorithm is often used when the servers are in different geographical locations. So if the user is near the server, the response time of that server will be the fastest. Finally that server will be selected to serve.

What is the Load Balancing algorithm – Least Connections

?The requests will be redirected to the server with the fewest connections in the system. This algorithm is considered a dynamic algorithm, because it has to count the number of active connections of the server.

Least Connections is likely to work well. Even if the load of the connections varies over a large range. So if using RC will overcome the disadvantages of Round Robin.

How does Load Balancing handle state

?How does Load Balancer handle state

In many cases the application requires the visitor to continue connecting to the same Backend Server. A source code algorithm will create a relationship based on the client’s IP information. For web applications through sticky sessions, the Load Balancer will set a cookie. All requests from sessions are directed to a physical server.

What is a redundant Load Balancer

?Installing a redundant Load Balancer is an optimal solution.

In many cases, only one Load Balancer is the only point of access. Therefore, we need a second Load Balancer. It will be connected to the original Load Balancer. The purpose is that each Load Balancer has the ability to detect errors and recover.

What happens when the main Load Balancer fails? The second balancer will take the responsibility instead, since DNS moves the user in. However, changing DNS can take a long time on the internet. And for automatic failover, administrators will allow flexible IP address Remapping. For example, this case is floating IPs.

IP Remapping eliminates caching problems inherent in DNS changes. IP Remapping will provide a static IP address. This IP address can be easily remapped as needed. Domain names can remain associated with IP addresses. While its own IP addresses are moved between servers.

See also: Download Fruit Game – Download Angry Fruit Game


Hopefully the information provided in the article will help readers get an overview of Load Balancing. It is one of the most important infrastructure components of the computer network industry. Please pay close attention to the information about them to improve performance as well as make users more satisfied with your network service.