Original: Intro to Load balancing for developers–the algorithms
Reprint: http://blog.gesha.net/archives/205/
Posted on Tuesday, March, 11:02 PM
- Random: This load balancing method randomly distributes load across the servers available, picking one via random number Generatio N and sending the current connection to it. While it was available on many load balancing products, its usefulness are questionable except where uptime is Concerned–a nd then, if you detect down machines.
- random: This load balancing algorithm randomly distributes requests between available servers, randomly picks a server by generating random numbers, and sends the current connection to it. The system sets up an array of servers that need to be load balanced, using a random number generator to determine who will get the next connection.
Plain Programmer Description:
The system builds an array of Servers being load balanced, and uses the random number generator to determine who gets the Next connection ... Elegant solution, and most often found in large software packages that has thrown load balancing in as a feat Ure.
- Round Robin: Round Robin passes each new connection request to the next server on line, eventually distributing C Onnections evenly across the array of machines being load balanced. Round Robin works well at most configurations, but could be better if the equipment so you are load balancing was not Rou ghly equal in processing speed, connection speed, and/or memory.
- Poll : circulate the request sequentially to the server, starting from 1 to N and then restarting. This equalization algorithm is suitable for all servers in the server group with the same hardware and software configuration and the average service request is relatively balanced.
Plain Programmer description:
The system builds a standard circular queue and walks Throu GH it, sending one request to the before getting to the start of the queue and doing it again. While I ' ve never seen the code (or actual load Balancer code for any of these for that matter), we've all written this que UE with the modulus function before. In school if nowhere else.
- Weighted Round Robin (called Ratio on The Big-IP): With The This method, the number of connections, and receives over time are proportionate to a ratio weight you define For each machine. This is a improvement over Round Robin because can say ' machine 3 can handle 2x the load of machines 1 and 2 ", and th E load balancer would send the requests to machine #3 for each request to the others.
- Weight: assigns different weights to each server depending on the processing power of the server, allowing it to accept service requests for the corresponding number of weights. For example: The weight of server A is designed to 1,b the weight of 3,c is 6, then server A, B, and C will receive service requests of 10%, 30%, 60% respectively. This equalization algorithm ensures that the high-performance server gets more usage and avoids overloading the server with low performance.
Plain Programmer description:
The simplest-to-explain for-one is, the system Makes multiple entries in the Round Robin circular queue for servers with larger ratios. So if you set ratios at 3:2:1:1 for your four servers and that's what's the queue would look like–3 entries for the first Ser Ver, the second, one for the third and fourth. In this version, the weights was set when the load balancing was configured for your application and never change, so the S Ystem'll just keep looping through that circular queue. Different vendors use Different weighting systems–whole numbers, decimals the must total 1.0 (100%), etc. n implementation detail, they all end up in a circular the queue style layout with more entries for larger ratings.
- Dynamic Round Robin (called dynamic ratio on the Big-IP): was similar to Weighted Round Robin, however, weights was based on continuous monitoring of the servers and was therefore C ontinually changing. This was a dynamic load balancing method, distributing connections based on various aspects of real-time server performance Analysis, such as the current number of connections per node or the fastest node response time. this application Delivery controller method is rarely available in a simple Load balancer.
- dynamic ratio: is similar to weight, but the weight value varies with continuous monitoring of the server. This is a dynamic load balancing algorithm based on real-time analysis of server performance, such as the number of connections or response times.
Plain Programmer Description:
If you think of Weighted Round Robin where the circular queue was rebuilt with new (dynamic) weights whenever it had been F Ully traversed, you'll be dead-on.
- fastest: The fastest method passes a new connection based on the fastest response time of all servers. This method is particularly useful in environments where servers is distributed across different logical networks. On the big-IP, only servers that is active would be selected.
- Fastest mode: pass-through connections to the fastest-responding servers. This algorithm can be particularly useful for situations where the server is in a different logical network. The Equalizer records the response time for each server and selects the fastest one. This is very straightforward, but can cause congestion, because the current response time is not necessarily 1s or 2s.
- Explain: The fastest mode algorithm is calculated based on the number of outstanding seven-tier requests. When a request is sent to a member, the LTM increments it by one counter, and then decrements the counter when the request is responded to. When the LTM receives a connection request, the member with the fewest outstanding requests is selected. If the VS is not associated with the seven-tier Profile,ltm is unable to track requests and responses, the load-balancing algorithm will "downgrade" to the minimum number of connections mode.
Plain Programmer Description:
The load balancer looks at the response time is attached server and chooses the one with the best response time. This was pretty straight-forward, but can leads to congestion because response time right now won ' t necessarily Be response time in 1 second or both seconds. Since connections was generally going through the load balancer, this algorithm was a lot easier to implement than you Migh t think, as long as the numbers is kept up to date whenever a response comes through.
These next three I use the big-IP name for. They is variants of a generalized algorithm sometimes called Long term Resource monitoring.
- Least Connections: With the-method, the system passes a new connection to the server that has the Least number O F Current Connections. Least Connections methods work best in environments where the servers or other equipment your is load balancing have Simil AR capabilities. This was a dynamic load balancing method, distributing connections based on various aspects of real-time server performance Analysis, such as the current number of connections per node or the fastest node response time. This application Delivery Controller method was rarely available in a simple load balancer.
- Minimum connections: Each request service of the client may have a large difference in the time of the server, and with longer working hours, if a simple round robin or stochastic equalization algorithm is used, the connection process on each server can be very different and does not achieve true load balancing. The least Connection equalization algorithm has a data record for each server in the internal load, records the number of connections currently being processed by the server, and, when there is a new service connection request, assigns the current request to the server with the least number of connections, making the balance more realistic and load balanced. This equalization algorithm is suitable for long-time processing of request services, such as FTP.
- However, like fastest, when the connection time is not the same can cause congestion-such as a server is processing a simple HTML page, while another is running a bunch of database queries to the JSP script, the number of connections is not suitable for this situation.
Plain Programmer Description:
This algorithm just keeps track of the number of connections attached to each server, and selects the one with the Smalles T number to receive the connection. Like fastest, this can cause congestion when the connections be all of different durations–like if one is loading a Plain HTML page and another is running a JSP with a ton of database lookups. Connection counting just doesn ' t account for the scenario very well.
- observed : The observed method uses a combination of the logic used in the Least Connections and Fastest algorithms to load balance connections to servers being load-balanced. With this method, servers is ranked based on a combination of the number of current connections and the response time. Servers that has a better balance of fewest connections and fastest response time receive a greater proportion of the con Nections. this application Delivery controller method is rarely available in a simple Load balancer.
- observation mode: Select the server for the new request based on the best balance between the number of connections and the response time.
Plain Programmer description:
This algorithm tries to merge fastest and Least Connections , which does make it more appealing than either one of the above than alone. In this case, an array was built with the information indicated (how weighting are done would vary, and I don ' t know even for F5, let alone we competitors), and the element with the highest value are chosen to receive the connection. This somewhat counters the weaknesses of the both of the original algorithms, but does no account for when a server was about To is overloaded–like when three requests to that Query-heavy JSP has just been submitted, but not yet hit the heavy Wo RK.
- Predictive : The predictive method uses the ranking method used by the observed method, however, With the predictive method, the system analyzes the trend of the ranking over time, determining whether a servers perform Ance is currently improving or declining. The servers in the specified pool with better performance rankings that is currently improving, rather than declining, re Ceive a higher proportion of the connections. The predictive methods work well in any environment. this application Delivery controller method is rarely available in a simple Load balancer.
- prediction Mode: predictive mode uses the same method as the observation mode, except that BIGIP uses the current performance metrics (number of connections and response times) of the collected server , for predictive analysis, select a server in the next time slice, and its performance will reach the best server to respond to user requests. The predictive mode tries to fix an issue in observation mode, and if the server's response time has started to decline, it is unlikely to accept the next request.
Plain Programmer description:
This method attempts to fix the one problem with observed B Y watching what's happening with the server. If its response time had started going down, it was less likely to receive the packet. Again, no idea what the weightings was, but an array was built and the most desirable is chosen.
You can see with some of these algorithms that persistent connections would cause problems. Like Round Robin, if the connections persist to a server for as long as the user session is working, some servers would bui LD a backlog of persistent connections that slow their response time. The Long term Resource monitoring algorithms is the best choice if you have a significant number of persistent connection S. Fastest works okay in this scenario also if you don't have access to any of the dynamic solutions.
You can see that some algorithms that encounter long connections can cause problems. Like polling, if a long connection keeps the user session so long, the server response time slows down when the number of connections backlog to a certain value. If you have a large number of long connections, the LTRM (long term Resource monitoring) algorithm is the best choice. If there is no dynamic solution, the fastest algorithm is more suitable for this scenario.
That's it for this week, next week we'll start talking specifically about application Delivery Controllers and WHA T they offer–which is a whole lot–that can help your application in a variety of ways.
Until then!
Don.
F5 load Balancing algorithm and fundamentals