Forum Discussion
bfuller_9471
Nimbostratus
Apr 06, 2010iRule - 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
}
}
- The_Bhattman
Nimbostratus
Hi bfuller, - bfuller_9471
Nimbostratus
No, we are trying to inject the lbcid variable into the html wherever links (href) or html forms are found.
- The_Bhattman
Nimbostratus
Have you looked into a stream profile? - hoolio
Cirrostratus
As Bhattman suggests, using a stream profile should be more efficient. You'd want to use a STREAM::expression based iRule to configure the stream profile. The wiki page (STREAM::expression) has a few examples to get you started.Aaron
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