Weighted Round Robin - Is it Possible?



  • I read in other places in this forum that I could force weighted round-robin by putting the same IP into the config multiple times.  I tried it but it didn't actually work, and I was wondering if anyone has been able to do it successfully.

    I found it will let me put it into the config (note 192.168.0.10 is in the pool twice):

    [2.0-RC3-IPv6][admin@vm-pfs-2.0-rc3.localdomain]/root(23): cat /var/etc/relayd.conf
    log updates 
    timeout 1000 
    table <vip1-realservers> { 192.168.0.10, 192.168.0.20, 192.168.0.30, 192.168.0.60, 192.168.0.10 }
    redirect "VIP1" {
      listen on 10.10.1.101 port 80
      forward to <vip1-realservers> port 80 check http '/'  code 200 
    }
    [2.0-RC3-IPv6][admin@vm-pfs-2.0-rc3.localdomain]/root(24): relayctl show summary
    Id      Type            Name                            Avlblty Status
    1       redirect        VIP1                                    down
    1       table           vip1-realservers:80                     active (5 hosts)
    1       host            192.168.0.10                    100.00% up
    2       host            192.168.0.20                    100.00% up
    3       host            192.168.0.30                    100.00% up
    4       host            192.168.0.60                    100.00% up
    5       host            192.168.0.10                    100.00% up</vip1-realservers></vip1-realservers>
    

    And I ran a script which basically wgets VIP1 multiple times, and as you can see even though I put 192.168.0.10 (web1) in the pool twice, it still only gets served 1/4 of the time.

    [root@centos ang]# ./refresh.sh 
    web1
    web2
    web3
    web6
    web1
    web2
    web3
    web6
    web1
    web2
    web3
    web6
    web1
    web2
    web3
    web6
    web1
    web2
    web3
    

    I'm just curious if anyone was able to tweak their load-balancing.



  • There is an example in the book, so I know it can be done.

    I would post it but then that defeats the purpose of buying the book  ;)



  • The example XIII is referring to is for 1.2.3, which isn't the same load balancer as 2.0. I'm not sure offhand if that works with relayd, you can do some searching on it to find the answer there.



  • Sorry, didnt see the 2.0 reference in your code sample. Several features are implemented differently in 2.0 from 1.2.3, this is one of them.


Locked