柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!
全部博文(1669)
分类: 系统运维
2012-10-19 09:17:30
2012-10-18 17:21:34| 分类: 负载均衡F5BIG-IP | 标签: |字号大中小
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… Far from an elegant solution, and most often found in large software packages that have thrown load balancing in as a feature.
Plain Programmer Description: The system builds a standard circular queue and walks through it, sending one request to each machine 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 queue with the modulus function before. In school if nowhere else.
Plain Programmer Description: The simplest way to explain for this one is that 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, that’s what the queue would look like – 3 entries for the first server, two for the second, one each for the third and fourth. In this version, the weights are set when the load balancing is configured for your application and never change, so the system will just keep looping through that circular queue. Different vendors use different weighting systems – whole numbers, decimals that must total 1.0 (100%), etc. but this is an implementation detail, they all end up in a circular queue style layout with more entries for larger ratings.
Plain Programmer Description: If you think of Weighted Round Robin where the circular queue is rebuilt with new (dynamic) weights whenever it has been fully traversed, you’ll be dead-on.
Plain Programmer Description: The load balancer looks at the response time of each attached server and chooses the one with the best response time. This is pretty straight-forward, but can lead to congestion because response time right now won’t necessarily be response time in 1 second or two seconds. Since connections are generally going through the load balancer, this algorithm is a lot easier to implement than you might think, as long as the numbers are kept up to date whenever a response comes through.
These next three I use the BIG-IP name for. They are variants of a generalized algorithm sometimes called Long Term Resource Monitoring.
Plain Programmer Description: This algorithm just keeps track of the number of connections attached to each server, and selects the one with the smallest number to receive the connection. Like fastest, this can cause congestion when the connections are 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 that scenario very well.
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 is built with the information indicated (how weighting is done will vary, and I don’t know even for F5, let alone our competitors), and the element with the highest value is chosen to receive the connection. This somewhat counters the weaknesses of both of the original algorithms, but does not account for when a server is about to be overloaded – like when three requests to that query-heavy JSP have just been submitted, but not yet hit the heavy work.
Plain Programmer Description: This method attempts to fix the one problem with Observed by watching what is happening with the server. If its response time has started going down, it is less likely to receive the packet. Again, no idea what the weightings are, but an array is 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 will build a backlog of persistent connections that slow their response time. The Long Term Resource Monitoring algorithms are the best choice if you have a significant number of persistent connections. Fastest works okay in this scenario also if you don’t have access to any of the dynamic solutions.
你可以看到,有些算法遇到长连接可能会导致问题。像是轮询,如果长连接保持用户会话那么久,当连接数积压到一定值时会导致服务器响应时间变慢。如果你有大量的长连接,LTRM( Long Term Resource Monitoring )算法是最好的选择。如果没有动态的解决方案,Fastest算法也比较适合这种场景。
负载均衡模式(Load Balancing Method)分为以下几种:
Round Robin:这是缺省的配置方式。用户的连接请求被平均地分配给作为负载均衡的所有节点。如果作为服务器节点的设备在处理速度和内存上是一致的,那么这样的处理方式是最合适的。
Radio:服务器节点先确定根据处理能力确定他们各自的处理请求比重,然后根据比重把请求发送到服务器节点进行处理,这样可以解决在pool中存在不同机器型号的均衡器设备问题。
Dynamic Radio:这和Radio类似,但是他们的请求处理比重是根据每个节点的处理能力而动态分配的。节点处理能力的监控可以实时地通过获得每个节点的当前连接数、最快的响应时间等动态性能确定。
Fastest:设备获得当前处理速度最快的节点,然后把处理请求发向这个最快的节点。
Least Connections:在所有节点有差不多的处理能力情况下,把当前的处理请求发送到当前连接数最少的服务节点。
Observed:这是Fastest和Least Connections模式的结合。所有的节点按照连接数和响应速度的总体情况进行排序,后续用户请求中更大比例让那些连接数少并且处理速度快的节点处理。这种方式对节点的处理性能不一致时适用。
Predictive:这种方式使用Observed方式的处理方式对节点进行排序,但是设备还考虑了这些节点处理能力的变化趋势以确定某个节点的处理能力是在上升还是在降低,让那些处理能力呈上升趋势的节点处理更多的请求。
12种算法包括:
? 轮询(Round Robin):顺序循环将请求一次顺序循环地连接每个服务器。当其中某个服务器发生第二到第7层的故障,BIG/IP就把其从顺序循环队列中拿出,不参加下一次的轮询,直到其恢复正常。
? 比率(Ratio):给每个服务器分配一个加权值为比例,根椐这个比例,把用户的请求分配到每个服务器。当其中某个服务器发生第二到第7层的故障,BIG/IP就把其从服务器队列中拿出,不参加下一次的用户请求的分配,直到其恢复正常。
? 优先权(Priority):给所有服务器分组,给每个组定义优先权,BIG/IP用户的请求,分配给优先级最高的服务器组(在同一组内,采用轮询或比率算法,分配用户的请求);当最高优先级中所有服务器出现故障,BIG/IP才将请求送给次优先级的服务器组。这种方式,实际为用户提供一种热备份的方式。
? 最少的连接方式(Least Connection):传递新的连接给那些进行最少连接处理的服务器。当其中某个服务器发生第二到第7层的故障,BIG/IP就把其从服务器队列中拿出,不参加下一次的用户请求的分配,直到其恢复正常。
? 最快模式(Fastest):传递连接给那些响应最快的服务器。当其中某个服务器发生第二到第7层的故障,BIG/IP就把其从服务器队列中拿出,不参加下一次的用户请求的分配,直到其恢复正常。
? 观察模式(Observed):连接数目和响应时间以这两项的最佳均衡为依据为新的请求选择服务器。当其中某个服务器发生第二到第7层的故障,BIG/IP就把其从服务器队列中拿出,不参加下一次的用户请求的分配,直到其恢复正常。
? 预测模式(Predictive):BIG/IP利用收集到的服务器当前的性能指标,进行预测分析,选择一台服务器在下一个时间片内,其性能将达到最佳的服务器相应用户的请求。(被bigip进行检测)
? 动态性能分配(Dynamic Ratio-APM):BIG/IP收集到的应用程序和应用服务器的各项性能参数,动态调整流量分配。
? 动态服务器补充(Dynamic Server Act.):当主服务器群中因故障导致数量减少时,动态地将备份服务器补充至主服务器群。
? 服务质量(QoS):按不同的优先级对数据流进行分配。
? 服务类型(ToS):按不同的服务类型(在Type of Field中标识)对数据流进行分配。
? 规则模式:针对不同的数据流设置导向规则,用户可自行编辑流量分配规则,BIG/IP利用这些规则对通过的数据流实施导向控制。