Forum Discussion

Jeff_Wyant_4852's avatar
Jeff_Wyant_4852
Icon for Nimbostratus rankNimbostratus
Jun 14, 2006

Direct a % Traffic to Two App Pools

Currently all web traffic goes to one app pool for our current web site. We are in the process or changing our web site and for testing purposes I need to write an irule that would direct a % of traffic to the new app pool. Somthing like 90% to the old site, and 10% to the new.

 

 

3 Replies

  • You could do this with a counter.

    when RULE_INIT {
       initialize the global counter
      set ::request_num 0
    }
    when HTTP_REQUEST {
       Increment the counter
      incr ::request_num
      if { $::request_num < 10 } {
         request 1-9 will go to poolA
        pool poolA
      } else {
         the 10th request will go to poolB
        pool poolB
         Reset the counter
        set ::request_num 0
      }
    }

    Basically this will keep a request counter. For the requests 1-9 it will use poolA (90%). For the 10th request (the other 10%) it will use poolB and then reset the counter.

    I'm sure there are other ways to do this but this should get you started.

    -Joe
  • Using the counter, will each http get request increment the counter? My question is how could I also keep the "session" going to the same enviroment, old or new?