Forum Discussion

sysadmin_2015_2's avatar
sysadmin_2015_2
Icon for Nimbostratus rankNimbostratus
Aug 05, 2015

iRule help - Routing traffic

Hello,

 

Is it possible once I implement the below iRule(25% percent of production web traffic being routed to staging_web pool) on our production web virtual server to then route all traffic from the staging_web pool to our staging_app pool of servers via the production app virtual server? The dev team does not want to change DNS entries once we do a deploy to staging then production.

 

when HTTP_REQUEST { if { rand() > 0.25 } { pool default-pool } else { staging_web } }

 

Thank you,

 

14 Replies

  • Interesting.

     

    The ratio might not be exact (depending on the number of incoming connections and luck) but it could work. It ain't pretty though. :) Just don't forget to add "pool" in front of staging_web.

     

    • Have you considered using ratio load balancing method?
    • Or adding the staging web member to the pool with icontrol when you deploy?
    • Or do a "rolling deploy" on one prod server at a time checking for errors that way.
    • Or let the developers set a cookie when accessing the site and send them to the staging pool for testing in production?

    Just a few suggestions.

     

    /Patrik

     

  • Thank you for reply. Is there a better iRule or way to route 25% of production traffic to another pool of servers?

     

    Thank you,

     

  • Sorry, One last thing. How would the iRule look if pool_1 was production and pool_2 was staging?

     

    Thank you,

     

  • It'd be something like this:

    when HTTP_REQUEST { 
        if { rand() > 0.25 } { 
            pool pool_1
        } else { 
            pool pool_2
        }
    }
    

    Please note that unless you use connection multiplexing this rule would establish a new connection server-side every fourth request (more or less). If I were you I'd change the event to CLIENT_ACCEPTED because:

    1. Then the connections would not have to be re-established saving server performance.
    2. The iRule is only executed once per connection instead of once per request saving LTM performance.

    Good luck!

    /Patrik

    • sysadmin_2015_2's avatar
      sysadmin_2015_2
      Icon for Nimbostratus rankNimbostratus
      Hello, Sorry for the delay, got pulled in another direction. But I have a couple of questions, I ran a JMeter test with a hundred threads(100 users) connecting to VirtualServer_01 and Pool_01_80. The test ran successful, under statics for VirtualServer_01 the Maximum connections showed 100 and it showed the same for Pool_01_80. Each pool has 5 web servers, during first test without iRule, each server showing 20 connections. I then cleared the statics and attached the below iRule to the virtual server. I then ran a second test with 100 threads(100 users). The virtual server showed 100 connection. Pool_01_80 showed 198 maximum connections and Pool_02_80 showed 51 maximum connections. Can you please tell me why the numbers seem off? I'm I reading it correctly? when HTTP_REQUEST { if { rand() > 0.25 } { pool Pool_01_80 } else { pool Pool_02_80 } } Thank you,
    • Patrik_Jonsson's avatar
      Patrik_Jonsson
      Icon for MVP rankMVP
      You've got two smart guys in there already and one is the legendary Joe. Rather not mess with their work and progress. :)
  • Still the syntax issue is n't resolved ...I would request immediate help to fix the issue ...

     

  • Hello,

     

    Sorry for the delay, got pulled in another direction. But I have a couple of questions, I ran a JMeter test with a hundred threads(100 users) connecting to VirtualServer_01 and Pool_01_80. The test ran successful, under statics for VirtualServer_01 the Maximum connections showed 100 and it showed the same for Pool_01_80. Each pool has 5 web servers, during first test without iRule, each server showing 20 connections. I then cleared the statics and attached the below iRule to the virtual server. I then ran a second test with 100 threads(100 users). The virtual server showed 100 connection. Pool_01_80 showed 198 maximum connections and Pool_02_80 showed 51 maximum connections. Can you please tell me why the numbers seem off? I'm I reading it correctly?

     

    when HTTP_REQUEST { if { rand() > 0.25 } { pool Pool_01_80 } else { pool Pool_02_80 } }

     

    Thank you,

     

    • Patrik_Jonsson's avatar
      Patrik_Jonsson
      Icon for MVP rankMVP
      Been wrecking my brain, but I can't explain that one. In my lab I got 3 times more connections to Pool _01 compared to Pool_02. No other interfering iRules?