Forum Discussion

paul_adomeit_70's avatar
paul_adomeit_70
Icon for Nimbostratus rankNimbostratus
Sep 28, 2006

Round Robin two pools

We were asked to balance four servers in a pretty unique way. The way to make it behave like it was requested would be to create two pools with all four members but have different priorities assigned so that for any one pool, only one server would be selected and only two total severs at a time would take traffic. We've written some pretty scarry iRules but I'm not sure how to write a rule that just round robin's two pools without looking for something first. Two VIP's is not an option, a single pool with priority activation would not work. We could make this happen by querying the node status's and build our logic around that but we like simple. Any simple ideas?

 

-p

4 Replies

  • Something like this should do the trick...

    when RULE_INIT {
      set ::NEXT_POOL 0  
    }
    when CLIENT_ACCEPTED {
      if { $::NEXT_POOL == 0 } {
        pool pool_a
        set ::NEXT_POOL 1
      } else {
        pool pool_b
        set ::NEXT_POOL 0
      }
    }

    This creates a global variable "NEXT_POOL" and then on each connection it toggles the pool to use.

    I don't know how to get away without making use of a global variable.

    -Joe
  • Joe,

     

    Thank you very much. This works just fine plus I got to learn just a little bit more. Neat stuff.

     

    -p

     

  • You would want to add persistence in the rule. One option is to use cookie insert based on the pool selected. Here is an example: (Click here)

     

     

    Aaron