Forum Discussion

sylvain_boily_1's avatar
sylvain_boily_1
Icon for Nimbostratus rankNimbostratus
Nov 18, 2014

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

  1. A VIP1 defined on the same F5 instance in partition "part1"
  2. 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
  }
}

1 Reply

  • What I would like to know is how can I have the CARP persistance with the iRule while using Virtual Servers of the Carp Pool members.

     

    Since it seems that F5 doesn't allow VS to have Vs as members. unless you use the 'virtual' keyword in an iRule.