Forum Discussion
Christian_Gebau
Nimbostratus
Jul 12, 2006iRule optimization / CPU usage monitor
Hi,
I am currently evaluating a BIG-IP load balancer. My goal is to
distribute incoming UDP packets (which conform to a custom network
protocol) to a cluster of linux servers. I use the round-robin
load balancing algorithm and no session persistance.
The load balancer has to execute an iRule for each incoming
packet in order to insert a sequence number into the UDP payload.
With my current setup I can handle about 20000 packets per second
on a BIG-IP 5100. Without the iRule the same box can handle up to
80000 packets/sec, therefore I would like to optimize my iRule.
Question 1)
Do you have any suggestions how I can speed the following iRule:
when RULE_INIT {
array unset sequence_number_map
array set sequence_number_map { }
}
when CLIENT_DATA {
global sequence_number_map
if { [UDP::payload length] > 4} {
binary scan [UDP::payload] II liid seid
if {[catch {set sequence_number [lindex $sequence_number_map($liid,$seid) 0]}]} {
set sequence_number 0
}
else
{
incr sequence_number
}
set sequence_number_map($liid,$seid) [list $sequence_number [clock seconds]]
UDP::payload replace 0 0 [binary format I $sequence_number]
}
} (The time stamp value in the sequence number map is used by another iRule that
removes obsolete entries in the map)
Question 2)
The web interface indicates that the TMM CPU usage doesn't exceed 50% during
my performance tests. Is this the normal behaviour? I would have expected values up
to 100%.
Best Regards,
Christian Gebauer
3 Replies
- unRuleY_95363Historic F5 AccountWhat version are you running?
The [clock seconds] command can be detrimental to performance prior to v9.2. Have you tried removing that since I don't see where you even reference that index of the list (I'm not sure why you are even using a list since you only seem to utilize the sequence number in position 0). Perhaps that was something you haven't utilized yet? Anyway, definitely try removing that and see if it helps. It doesn't sound like you are running into a bottleneck based on CPU load. - Christian_Gebau
Nimbostratus
Hi,
we are using "BIG-IP 9.2.3 Build 34.4"
The reason for storing the current time stamp in the map with the sequence numbers is that we have to remove obsolete items from this map at some point in time. Its not possible to detect the end of a session/connection by parsing the content of the UDP packets so we have to rely on removing entries after some timeout. We plan to do this cleanup in a different iRule (because the timer event is not yet available)
I removed the list/timestamp code and did a test. If I just store the sequence number the rule uses an average of 32600 cpu cycles. This is not much lower than the value for the original rule (35500 cycles). The worst offenders seem to be the two commands for reading and writing the UDP payload. A rule that just contains the "binary scan" and "payload replace" commands uses 21300 cycles.
Best Regards,
Christian- pirusti
Nimbostratus
how do you manage to get those numbers, i mean how do you measure the cpu cycles that an iRules uses.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
