Timing is a command in iRules that triggers the system to track the number of cycles each event in an iRule consumes.  Deb has covered timing previously in iRules Optimization 101 #05 – Evaluating iRule Performance, so I took that and a presentation someone internally put together from that information and recorded a walkthrough on what makes timing tick.  (ba-dah, ching!)

I also took the opportunity to dust off my pycontrol skills and whipped up a script that will do some load testing against a virtual with your iRule applied, then download and crunch the stats specific to your platform cores/speeds so the numbers should be accurate. 

I uploaded the script to the iControl codeshare, titled pycontroliRuleTiming.  A sample of the output from the script is below:

jrahm@jrahm-dev:/var/tmp$ ./iRuleStats.py 10.10.20.5 admin timing_test http://10.10.20.50
Please enter your password:
Password:

Resetting Statistics for the timing_test iRule

Running load test to host http://10.10.20.50
### Raw Data ###
Event:  HTTP_REQUEST
        STATISTIC_RULE_AVERAGE_CYCLES = 41767
Event:  HTTP_RESPONSE
        STATISTIC_RULE_AVERAGE_CYCLES = 92363

### iRule timing_test Performance Results
        BIG-IP LTM 3600 has 3413568000 availabe CPU Cycles (2 cores, 2133.480 MHz)
        Average Cycles/sec:     134130
        CPU Utilization/req:    0.00392931970302 percent
        Max Requests/sec:       25449

Happy coding!

Related Articles