Forum Discussion

jaimes_39948's avatar
jaimes_39948
Icon for Nimbostratus rankNimbostratus
Aug 03, 2012

iRule that percentage Load Balances Between Two CDN CNAMEs

Starting a new post, because I think my previous one might be off topic. I have a need to have the GTM load balance, percentage wise, between to AWS CDN CNAMES I have the WideIP setup using pools that don't have VS assigned but as assigned with the CDN CNAMES. Trying to figure out how to load balance the requests so that 2% of the resolution goes to the second CNAME.

 

 

I have the above iRule setup.

 

 

when DNS_REQUEST {

 

if { rand() < 0.02 } {

 

cname www-1378117844.us-west-1.elb.amazonaws.com

 

}

 

}

 

 

The wideIP points to a pool that has the other CDN CNAME in it. The question is, how do I load balance between both CDN CNAMES within the Irule. For instance if I wanted 60 percent to goto one CNAME and 40 percent to the other?

 

 

Thanks in advance,

 

Jaime

 

  • Hi Jaime,

    Can you try this:

    when DNS_REQUEST {
    if { rand() < 0.60 } {
    cname www-1378117844.us-west-1.elb.amazonaws.com
    } else {
    cname other.amazonaws.com
    }
    }
    

    Aaron