keepalived and LVS scheduling algorithm

Source: Internet
Author: User
Load scheduling algorithm
1 The Round Robin (RR) scheduler assigns external requests sequentially to the real servers in the cluster through a "wheel call" scheduling algorithm, which treats each server equally regardless of the actual number of connections and system load on the server.
The following is a look at the effect of the wheel call scheduling, as follows: while ((1)); Do ipvsadm-l; Sleep 1; Done
Client testing: Ab-n 1000-c http://10.1.1.166/Note: here with AB 10.1.1.166 first page 1000 pages, and 100 connections are concurrent.
LVS performance is as follows: while ((1)); Do ipvsadm-l; Sleep 1; Done      IP Virtual Server version 1.2.1 (size=4096) prot localaddress:port Scheduler Flags    - > Remoteaddress:port                forward Weight activeconn Inactconn TCP   10.1.1.166:www RR    -> 10.1.1.164:www            &NB sp;         route    1         0      &nbs p;        0                 -> 10.1.1.163:w WW                      route    1         0               0              IP Virtual Server version 1.2.1 (size=4096) prot localaddress:port Scheduler Flags &nbsP  -> remoteaddress:port                forward Weight Activeconn inactconn TCP   10.1.1.166:www RR    -> 10.1.1.164:www         &nbsp ;            route    1         5                              -> 10.1.1. 163:www                      route    1 & nbsp       6                &nbsp      ;    IP Virtual Server version 1.2.1 (size=4096) prot localaddress:port Scheduler Flags    -> Remotea Ddress:port                forward Weight activeconn inactconn TCP &nbs P 10.1.1.166:www RR   -> 10.1.1.164:www                       Route    1         6               138 &NB Sp            -> 10.1.1.163:www             & nbsp        route    1         5         & nbsp;     140           IP Virtual Server version 1.2.1 (size=4096) Prot Loca Laddress:port Scheduler Flags    -> remoteaddress:port                 forward Weight activeconn inactconn TCP   10.1.1.166:www RR    -> 10.1.1.164:www   &NB sp;                  route    1                      174              -> 10.1.1.163:w WW                      route    1         notoginseng             176         &NB Sp IP Virtual Server version 1.2.1 (size=4096) prot localaddress:port Scheduler Flags    -> Remoteaddress:port & nbsp              forward Weight activeconn inactconn TCP   10.1.1.166:WWW R R    -> 10.1.1.164:www                      route    1         5               2              -> 10.1.1.163:www          &nbsp ;           route    1         3         &nbsp ;     293           IP Virtual Server version 1.2.1 (size=4096) Prot Localadd Ress:port Scheduler Flags    -> remoteaddress:port             & nbsp  forward Weight activeconn inactconn TCP   10.1.1.166:www RR    -> 10.1.1.164:www    &nbs P                 route    1       & nbsp             483              -> 10.1 .1.163:www                      route    1                     483      &N bsp;    IP VirTual Server version 1.2.1 (size=4096) prot localaddress:port Scheduler Flags    -> remoteaddress:port                forward Weight activeconn inactconn TCP   10.1.1.166:WWW R R    -> 10.1.1.164:www                      route    1         0               5              -> 10.1.1.163:www          &nbsp ;           route    1         0      & nbsp;        502          
We see that 1000 connections are distributed evenly to two machines.
Note L Activeconn is the active connection number, which is the established of the TCP connection state. Inactconn is the TCP connection of all other states except established.
2) The weighted wheel call (Weighted Round Robin) (WRR) Scheduler calculates weight ratios based on real server weighting values (weight) by the "Weighted wheel call" scheduling algorithm, and ultimately requests more of the real server to be sent to. If the weighted value is not defined, i.e. the weighted value defaults to 1, then the WRR is the same as the RR scheduling algorithm. We modify weight below, as follows: Virtual_server 10.1.1.166 {            delay_loop 6   &N bsp;         lb_algo wrr             lb_kind DR &nb Sp            #persistence_timeout             protocol TCP             real_server 10.1.1.163 {     &NB sp;                  weight       & nbsp                 tcp_check {        & nbsp;                          & Nbsp;conneCt_timeout                         & nbsp           nb_get_retry 3               & nbsp;                     delay_before_retry 3 & nbsp                            & nbsp;      connect_port                  & nbsp;      }             }         & nbsp;   real_server 10.1.1.164 {                 &nb sp;      weight 5                   & nbsp     tcp_check {                           & nbsp        connect_timeout-               & nbsp                    nb_get_retry 3      & nbsp;                          & nbsp;   delay_before_retry 3                   & nbsp                 connect_port,                                     & nbsp;} }

Here we test again, as follows: client: Ab-n 1000-c http://10.1.1.166/
Lvs:ip Virtual Server version 1.2.1 (size=4096) prot localaddress:port Scheduler Flags-> remoteaddress:port    Forward Weight activeconn inactconn TCP 10.1.1.166:www wrr-> 10.1.1.164:www Route 5 0 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.