cmp
6 TopicsCMP v10.0 compatible counters using the session table
Problem this snippet solves: This simple iRule shows how you can create a CMP-compatible counter. The first portion of the iRule demonstrates creating and incrementing a global counter which is accessible across all virtual servers and all TCP connections. The second portion of the iRule shows a method for creating a VIP-specific global counter. There is no enforcement of access to the VIP-specific global counter but it should prevent accidental trampling of session table entry names. For details on CMP compatibility you can check these resources: https://devcentral.f5.com/wiki/iRules.CMPCompatibility.ashx https://support.f5.com/kb/en-us/solutions/public/7000/700/sol7751.html Code : when CLIENT_ACCEPTED { set log_prefix "[virtual name] [IP::client_addr]:[TCP::client_port]" } when HTTP_REQUEST { ####################################################################### # # Global (accessible across all VIPs) counter variable example # using the session table # # Look up the counter value. Will return a null string if it doesn't exist set value [session lookup uie "my_counter"] log local0. "$log_prefix: Global lookup value: $value" # Check if the value is null if {$value eq ""}{ # Add a new session table entry with a value of 0 session add uie "my_counter" 0 } else { # Increment the current value by 1 session add uie "my_counter" [expr {$value + 1}] } # Log the updated value log local0. "$log_prefix: Global lookup value: [session lookup uie "my_counter"]" ####################################################################### # # Local (accessible to only this VIP) counter variable example # using the session table # # Save the virtual server name to use as a session table entry prefix # This keeps the variables specific to the virtual server. set vip [virtual name] # Look up the counter value. Will return a null string if it doesn't exist set value [session lookup uie "${vip}_my_counter"] log local0. "$log_prefix: Per-vip lookup value: $value" # Check if the value is null if {$value eq ""}{ # Add a new session table entry with a value of 0 session add uie "${vip}_my_counter" 0 } else { # Increment the current value by 1 session add uie "${vip}_my_counter" [expr {$value + 1}] } # Log the updated value log local0. "$log_prefix: Per-vip lookup value: [session lookup uie "${vip}_my_counter"]" } Tested this on version: 10.0469Views0likes1CommentiRule development: subtable spreading among TMMs
Hi, I'm trying to understand the best way to design an iRule that will need to handle a lot of table entries and do that fast, as we're talking about rate limit on client connections. I've found a very useful example of an iRule that create some subtables so they're spreaded among the TMMs, but I don't fully understand how it works. In the documentation about the "table" command I read "All of the entries in a given subtable are on the same processor. So if you put all of your entries (or the vast majority of them) into the same subtable, then one CPU will take a disproportionate amount of memory and load." So if I understand it right, each subtable will be pinned to a processor, so creating several subtables I'd be able to spread it among the processors and the iRule will handle the data on the subtables more efficiently, right? I'm working on a Viprion with 2 B2150. Each blade has a Intel Quad Core processor, that gives me just a tmm process that creates 4 threads, one for each core. The Hyperthreading in the processor gives me 8 virtual processing cores, but from the point of view of the TMM the system has 4 cores per blade, right? In summary, the TMM::cmp_count variable gives me a value of 8, I guess that this 8 are the 8 physical cores that I got with those 2 quad core processors, right? I think that I'd have to create at least 8 subtables to get advantage of the data spreading among cores, wight? (1 subtable per core) so... what's the real meaning of that ~3+ factor??? does it mean that I'm creating 3 subtables per core? why a value of 3 and not, for example, 2 or 4? I guess that maybe that 3 factor depends on how much data you have to handle, maybe "1 * TMM::cmp_count" is enough if my subtable doesn't grow to much, maybe if I want smaller subtables I have to use "2 * TMM::cmp_count", "3 * TMM::cmp_count" or even "4 * TMM::cmp_count" right? Someone can explain me the meaning of that 3 factor???? Thanks! :)365Views0likes4CommentsConver Data Group List to static variables
I am looking to convert the global variables listed in Data Group List to a list of static variables. I am doing this as the virtual server associated with a few iRules are accessing them that would demote CMP. I am planning to create an iRule having only RULE_INIT that would set the static variables. Is there a good migration plan or if there is a better way to do this, can anyone suggest? Thanks!277Views0likes5CommentsWhiteboard Wednesday: Clustered Multiprocessing
In this edition of Whiteboard Wednesday, Jason tackles the basics of Clustered Multiprocessing, or CMP. Resources Clustered Multiprocessing White Paper In the age of software defined everything, does your device architecture matter? CMP Overview for TMOS 11.3+ CMP Overview for TMOS 9 - 11.2 iRules CMP Compatibility - DevCentral Wiki173Views0likes0CommentsBetter Round Robin
Problem this snippet solves: Implements Round Robin LB to avoid CMP idiosyncracies How to use this snippet: Attach this iRule to virtual server Code : when RULE_INIT { set static::betterRoundRobinDebug 1 } when CLIENT_ACCEPTED { set betterRoundRobinPoolMemberPick [lindex [active_members -list [LB::server pool]] [expr {[table incr [virtual]_count] % [active_members [LB::server pool]]}]] if {$static::betterRoundRobinDebug} { log "LB Pool: [LB::server pool] - ActiveMembersList: [active_members -list [LB::server pool]] - Attempt to Pick: $betterRoundRobinPoolMemberPick" } pool [LB::server pool] member [lindex $betterRoundRobinPoolMemberPick 0] [lindex $betterRoundRobinPoolMemberPick 1] } Tested this on version: 12.1149Views0likes0CommentsQuery on HTSplit and CMP
Hello Folks, I am trying to understand threading and HTSplit feature on BIG-IP. As per https://support.f5.com/csp/article/K14358, lets consider the example of BIG-IP 3900 and 4000. 3900 - 1 Quad Core 4000- 1 Quad Core (+HT) If my understanding is correct, each physical CPU on a BIG-IP device corresponds to a relevant TMM process. So considering above example, Number of TMM process on either device = 1 Now 1 CPU considering 4 cores will have equivalent 4 threads of TMM. Now the point which i am not able to relate to is: TMM threads (>=11.3.0, or >=11.5.0 with HTSplit disabled): 39001 Quad-core1 TMM threads : 4 4000/4200 1 Quad-core (+HT)1 TMM threads : 8 TMM threads(>=11.5.0 with HTSplit enabled, default) 39001 Quad-core1 TMM threads : 4 4000/4200 1 Quad-core (+HT)1 TMM threads : 4 Why is TMM thread =4 with HTsplit enabled on 4000 ?135Views0likes0Comments