Forum Discussion

Matt_Breedlove_'s avatar
Matt_Breedlove_
Icon for Nimbostratus rankNimbostratus
Apr 18, 2009

Feedback on multi-pool irule

Please provide some feed back on this irule which is mean to relativley evenly distribute inbound traffic thgrough a single VS across 2 pools of servers depending on which pool has more active members compared to the other. If both pools have 0 active members or LB_Failed then the connection is sent to a third apology page pool.

 

 

Long term vision is to scale this up to several pools of servers. Each pool contains groups of servers with specific horsepower quotients.

 

 

By using good ecv monitor we expect this irule should auto adjust connection load across pools based on strength of pool health by looking at active members.

 

 

There are two "HTTP_REQUEST" blocks below. Which is more efficient?

 

Should a switch statement be used? This will be used on a very busy site which is why I wanted to stear clear of anything intensive like regex or enc/dec stuff

 

 

Is there a better method to do this?

 

 

when LB_FAILED {

 

pool pool_sorry

 

}

 

 

when HTTP_REQUEST {

 

if { [active_members pool_a] > [active_members pool_b] } {

 

if { [active_members pool_a] = 0 } {

 

pool pool_sorry

 

} else {

 

pool pool_a

 

}

 

} else {

 

if { [active_members pool_b] = 0 } {

 

pool pool_sorry

 

} else {

 

pool pool_b

 

}

 

 

}

 

}

 

 

when HTTP_REQUEST {

 

if { [active_members pool_a] > [active_members pool_b] } {

 

pool pool_a

 

} else {

 

pool pool_b

 

}

 

}

 

 

  • Posted By mattbreedlove on 04/17/2009 11:41 PM

    Please provide some feed back on this irule (below) which is meant to relatively evenly distribute inbound traffic through a single virtual server across 2 or more pools of servers depending on which pool has more active members compared to the other. If both pools have 0 active members or LB_Failed then the connection is sent to a third apology page pool.

    Long term idea is to scale this up to several pools of servers. Each pool contains groups of servers with specific horsepower quotients.

    By using good ecv monitors we expect this irule should auto adjust connection load across pools based on strength of pool health by looking at active members.

    Each individual pool itself will use round robin internally.

    There are two "HTTP_REQUEST" blocks below. Which is more efficient?

    Should a switch statement be used? This will be used on a very busy site which is why I wanted to stear clear of anything intensive like regex or enc/dec stuff

    Is there a better method to do this?

      
      
     when HTTP_REQUEST {   
     if { [active_members pool_a] > [active_members pool_b] } {   
     if { [active_members pool_a] = 0 } {   
     pool pool_sorry   
     } else {   
     pool pool_a   
     }    
     } else {   
     if { [active_members pool_b] = 0 } {   
     pool pool_sorry   
     } else {   
     pool pool_b   
     }    
     }  
     } 
     when LB_FAILED {   
     pool pool_sorry   
     }     
     

     
     when HTTP_REQUEST {   
     if { [active_members pool_a] > [active_members pool_b] } {   
     pool pool_a   
     } else {   
     pool pool_b   
     }   
     }   
     when LB_FAILED {   
         pool pool_sorry 
     }   
     
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    In a quick test with a VIP pointing to a pool with no active members, LB_FAILED is triggered immediately. If you take the monitor off the pool, LB_FAILED isn't triggered immediately. See the LB_FAILED wiki page for details on this (Click here).

     

     

    So assuming you always have a valid monitor associated with the pool, I don't think you need to check the pool status in HTTP_REQUEST. But it would be good to do load testing of any rule that will see heavy use.

     

     

    Aaron