Forum Discussion
hooleylist
Apr 29, 2008Cirrostratus
Hi,
Global variables (like $::my_var) are shared across all iRules on all VIPs on all TCP connections. Local variables (like $my_var) are shared across the same TCP connection for any iRule(s) associated with the same virtual server. So if you set myvar in rule1 on vip1 and add a second rule to vip1, that same variable instance is accessible (and can be trampled) in rule2. If you want distinct local variable instances on multiple rules on the same VIP, you can name them uniquely. Using unique variable names per VIP is also important for global variables if you don't want other rules to be able to impact a separate rule. A good example of this is using a global debug variable. You probably wouldn't want debug enabled in every rule if you change the global variable in a single rule. So you can use a naming convention that includes the rule name or application (like ::irule1_debug instead of ::debug).
Aaron