Forum Discussion
TMM utilization increaseing after iRule change
Hardware: LTM6900 (4 TMM processes)
Ich have an iRule in place since more then a year.
Now I did create an additional new iRule which is based on that one.
The big distinctive change which differs from the origin one is:
...
...
if { "$uri_orig" contains "/v/" or "$uri_orig" contains "/w/" } {
set rule_active 0
log local0. "rule_active: none"
} else {
set uri_new $uri_prefix_category$para_cn
}
...
...
Problem:
TMM1.0 has 3 times more CPU utilization then the other 3 tmm's since I activated the new iRule???
TMM1.0 = 10%
TMM2.0 = 3%
TMM3.0 = 3%
TMM4.0 = 3%
I don't use any datagroup instances in this case.
Does somebody know why that is?
many thx for any help
Andrea
5 Replies
- The_Bhattman
Nimbostratus
Hi Andrea,
It's hard to tell what is happening here with the difference. One hand you are using a "contains" which may be increasing the CPU cycles because it's looking at the entire URI. Is it possible to post the original?
There is also an article about evaluating Irule performance that you can look at. The following link will take you to an excellent article about measuring optimization.
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/123/iRules-Optimization-101--05--Evaluating-iRule-Performance.aspx
I hope this helps
Bhattman - Andrea_Arquint
Nimbostratus
Hi BhattmanI don't know how to post it as a code here in this forum.
I just paste the rule code into notepad and then into here.
here is the rule:
when HTTP_REQUEST {
don't run the rule if it's a mobile redirectif {[info exists mobile_match] && $mobile_match==1} {log local0. "It's a mobile client: [IP::client_addr]"} else {log local0. "normal client: [IP::client_addr]"set rule_active 1set default_category 1set uri_orig [string tolower [HTTP::uri]]set uri_prefix_category "/default/defaultcatg.asp?rewrite=1&catg="set uri_prefix_listing "/default/defaultlist.asp?rewrite=1&catg="set uri_prefix_carsandbikes_listing "/carsandbikes/defaultlist.aspx?rewrite=1&categorynr="Required paramsset para_c [findstr $uri_orig "/c/" ]set para_l [findstr $uri_orig "/l/" ]set para_b [findstr $uri_orig "/b/" ]if { $para_c ne "" } {set parameters [findstr $para_c "/c/" 2]log local0. "Parameter para_c: $para_c $parameters"} elseif { $para_l ne "" } {set parameters [findstr $para_l "/l/" 2]log local0. "Parameter para_l: $para_l $parameters"} elseif { $para_b ne "" } {set parameters [findstr $para_b "/b/" 2]log local0. "Parameter para_b: $para_b $parameters"} else {set parameters ""}log local0. "Parameters: $parameters"Optional paramsset para_cn [findstr $parameters "/cn" 3 "/"]set para_an [findstr $parameters "/an" 3 "/"]set para_ln [findstr $parameters "/ln" 3 "/"]set para_ls [findstr $parameters "/ls" 3 "/"]set para_lt [findstr $parameters "/lt" 3 "/"]set para_pn [findstr $parameters "/pn" 3 "/"]set para_ps [findstr $parameters "/ps" 3 "/"]set para_xml [findstr $parameters "/xml" 4 "/"]log local0. "Parameter para_an: $para_an"switch -exact $uri_orig {"/kaufen" -"/acheter" -"/kobe" -"/kjope" -"/pris" -"/angebote" -"/buy" {HTTP::respond 301 Location http://[HTTP::host][HTTP::uri]/}}switch -glob $uri_orig {"/kaufen/*" -"/acheter/*" -"/kobe/*" -"/kjope/*" -"/pris/*" -"/angebote/*" -"/buy/*" {Process required parametersSet the correct categorynumberif { $para_cn equals "" } {set para_cn $default_category} else {do nothing}Set the article numberif { $para_an != "" } {Add auctionnr to the URIset para_an "&auctionnr=$para_an"}Workaround for "v" and "w" else Default new_uriif { "$uri_orig" contains "/v/" or "$uri_orig" contains "/w/" } {set rule_active 0log local0. "rule_active: none"} else {set uri_new $uri_prefix_category$para_cn}Process URI prefixCreate URI prefix for listing pageif { $para_l != "" } {set uri_new $uri_prefix_listing$para_cn} elseif { $para_b != "" } {set uri_new $uri_prefix_carsandbikes_listing$para_cn} else {set uri_new $uri_prefix_category$para_cn}Process optional parametersif { $para_ln != "" } {Add langeuagenr to the URIset uri_new "$uri_new&languagenr=$para_ln"}if { $para_ls != "" } {Add listingsort to the URIset uri_new "$uri_new&listingsort=$para_ls"}if { $para_lt != "" } {Add listingtype to the URIset uri_new "$uri_new&listingtype=$para_lt"}if { $para_pn != "" } {Add pagenumber to the URIset uri_new "$uri_new&pagenr=$para_pn"}if { $para_ps != "" } {Add pagesize to the URIset uri_new "$uri_new&pagesize=$para_ps"}if { $para_xml != "" } {Add xml to the URIset uri_new "$uri_new&xml=$para_xml"}Set new URLlog local0. "[HTTP::host] $uri_orig $uri_new"if { $rule_active ne 0 } {if {[catch { HTTP::header insert "X-REWRITTENURL [HTTP::uri]" } result]} {log local0. "[HTTP::host] [IP::client_addr]:[TCP::local_port] Error on Header Insert X-REWRITTENURL"}if { [HTTP::uri] equals $uri_new } {log local0. "[HTTP::uri] URLs equal!"}HTTP::uri $uri_newlog local0. "[HTTP::host] [HTTP::uri] -> $uri_new"}}}}}
Thanx for help
- Andrea_Arquint
Nimbostratus
Hi BahttmanI did activate the timing:
b rule irule_global_rewrite_buy_page_new show all
RULE irule_global_rewrite_buy_page_new
+-> HTTP_REQUEST 1424 total 0 fail 0 abort
| Cycles (min, avg, max) = (523003, 640003, 2456714)
I cannot massure if it's a problem or if these stats normal.
thanx
andrea
- The_Bhattman
Nimbostratus
Hi Andrea,
The timing is to specifically to help you change your code to reduce the CPU cycles - it wasn't design to poinpoint where the in the code it took up the CPU cycles. However, this should help you choose the best way to optimize your code.
Bhattman - hoolio
Cirrostratus
You can edit your post and use [ code ] [/ code ] tags to preserve the spacing.
Do you have another iRule on the virtual server which could be preventing CMP? That could explain high CPU0 usage. See this article for details:
http://devcentral.f5.com/wiki/default.aspx/iRules/CMPCompatibility.html
Are you logging for every connection? If so, you might try commenting out all of the logging.
You could also put add the 'return' command after each HTTP::respond/redirect to exit the current event in the current iRule:
http://devcentral.f5.com/wiki/default.aspx/iRules/return
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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