Forum Discussion
Robert_47833
Jul 21, 2011Altostratus
will rand() cause performance issue
rand()
one question about rand
will rand cause performance issue?How to test it?
Can u give me an example
We want to put rand() in production
Robert_47833
Jul 27, 2011Altostratus
Hi,Ryan
what I am trying to achieve is:
I have two pool cjj1 and cjj2
20% request to cjj1 while 80% request to cjj2
in one session,the 20% user will still persist hit pool cjj1
when HTTP_RESPONSE {
HTTP::header replace StubHubBlade [LB::server name]
if { $stubhubA_cookie == 1 }{
HTTP::cookie insert name stubhubA_cookie value 1 path "/"
}
if { $stubhubB_cookie == 1 }{
HTTP::cookie insert name stubhubB_cookie value 1 path "/"
}
when HTTP_REQUEST timing on {
if {[class match $uri starts_with gen3abURLs_SRWD29]} {
if {[HTTP::cookie value stubhubA_cookie] == 1}{
pool cjj1
return
}
if {[HTTP::cookie value stubhubB_cookie] == 1}{
pool cjj2
return
}
if { rand() <0.2 } {
pool cjj1
set stubhubA_cookie 1
return
}
else {
pool cjj2
set stubhubB_cookie 1
return
}
1:do we have other method to achieve this?
2:if not,how to optimize this rand()?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects