sylvain_boily_1
Nov 18, 2014Nimbostratus
Using iRule for Carp profile persistent while using an iRule for virtual server assignation : Possible ?
Hello,
We have the following setup:
A/B VIP with a persistent profile (Carp iRule) which as a pool assigned. This vip is part of the Common Partition.
The pool as two members
- A VIP1 defined on the same F5 instance in partition "part1"
- B VIP2 defined on the same F5 instance in partition "part2"
we want to change the ratio of the members to decide the % of the traffic we have between A and B environment.
the following Carp iRule is used to make sure that once a user start using the new environment (A taking 100% traffic, all user are hitting A. % is increased to 20% B and 80% A. All user now hitting the B environment should stick to the B environment.
Carp Irule is defined as follow.
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
set sid [findstr [TCP::payload] "" 5 ""]
log local0. "UNIQUE USER ID: | $sid"
persist hash $sid
TCP::release
}
My first attempt at the virtual server iRule was this, which doesn't work since I'm basically creating a round robin between the two VIPs instead of using the pool ratio mode.
when RULE_INIT {
set ::NEXT_POOL 0
}
when CLIENT_ACCEPTED {
if { $::NEXT_POOL == 0 } {
virtual a_vs
set ::NEXT_POOL 1
} else {
virtual b_vs
set ::NEXT_POOL 0
}
}