bfuller_9471
Apr 06, 2010Nimbostratus
iRule - a better way?
Hi, during performance tests we are crushing the BigIP TMM cpu to the point where BigIP is lagged.
I've narrowed it down to the regsub's in this method which was written 5 years ago. Is there a better way of doing this?
when HTTP_RESPONSE_DATA {
set payload [HTTP::payload]
when payload is received, insert ID parameter into each URL
this expression inserts the ID into URIs with ? already
regsub -all {(/wps/.*?portal/ts/)([^>]+)(\?)([^<]+)(\"|\s)} $payload "\\1\\2\\3LBCID=$id\\&\\4\\5" payload
this expression inserts the ID into URIs without ?
regsub -all {(/wps/.*?portal/ts/)([^?]+)(\"|\s)} $payload "\\1\\2\?LBCID=$id\\3" payload
these expressions insert a hidden parameter containing $id into forms using the GET method
(browser is not submitting the URI parameter previously inserted)
Optimization options:
2nd regsub may be removed if all form actions can be modified to take the consistent order of <...method="get" action="/wps/...>
case sensitivity flag (?i) may also be removed if all form actions are consistent in case for the above string (All Caps in code and regsub recommended)
regsub -all {(?i)(method=\"get\" action=\"/wps/.*?portal/ts/.*?)(\\2" payload
regsub -all {(?i)(action=\"/wps/.*?portal/ts/.*?method=\"get\".*?)(\\2" payload
HTTP::payload replace 0 [HTTP::payload length] $payload
HTTP::release
}
}