Forum Discussion
Fernando_Martín
Nimbostratus
Apr 01, 2010Optimize iRule for ASM
Dear all,
recently we are designed and activated an iRule to make several decisions:
- when there isn't any member available in the production pool, the request is redirected to a sorry;
- in other case the request is redirected to ASM.
This second case is a little special because the web app is written using two diferent charsets, win-1252 and utf-8, that are used depending of the first level of uri path. For example:
- utf-8: http://server/PATH1/piemf.txt or http://server/PATH2/qwxsa.txt
- win-1252: anypath else
We are developed an iRule to do this:
__> SORRY_POOL
______ _______ /
USER --->| vs |-->|iRule| --->HTTPClass_PROD_POOL_PATH1_PATH2-----> PROD_POOL
------ ------- \__>HTTPClass_PROD_POOL_PATH1_PATH2__/
\_>HTTPClass_PROD_POOL_REST________/
And this is the code:
when HTTP_REQUEST {
set debug "0"
if { [active_members PROD_POOL] < 1 } {
Pool selected in case of all production members are down
if { $debug } { log local0. "select Sorry" }
ASM must not work
HTTP::class disable
PoolSorry becomes traffic
pool SORRY_POOL
} else {
The variable gets the first level of path
set URI_value [findstr [HTTP::uri] "/" 1 "/"]
if { $debug } { log local0. "uri $URI_value" }
switch $URI_value {
PATH1 {
if { $debug } { log local0. "PATH1" }
HTTP::class enable
HTTP::class select HTTPClass_PROD_POOL_PATH1_PATH2
}
PATH2 {
if { $debug } { log local0. "PATH2" }
HTTP::class enable
HTTP::class select HTTPClass_PROD_POOL_PATH1_PATH2
}
default {
if { $debug } { log local0. "REST" }
HTTP::class enable
HTTP::class select HTTPClass_PROD_POOL_REST
}
}
}
}
This rule is applied in several VS.
Now all this configuration is applied and it works, but the performance of CPUs is very high (CPU0: 80%, CPU1: 100%, AVERAGE: 90%). The main overhead is being introduced by ASM (we can see in ASM CPU Graphs), but it is only a 40 % of CPU0.
We haven't an exact value of CPU impact of this iRule, but we think that it could be optimized to reduce the resouces needed.
Does someone how could we do better the iRule to reduce CPU utilization??
Regards,
fermarloe
4 Replies
- hoolio
Cirrostratus
Hi Fernando,
Which ASM version are you running (b version)? And which platform are you running ASM on (b platform | head)?
I expect that the increased load is due to ASM--not the iRule. For 9.x, ASM processes (mainly bd and mysqld) run on CPU0 and TMM runs on CPU1. And iRules run within TMM. So if you're seeing low CPU1 usage, it means the iRule is not the major concern. You might be able to optimize the iRule slightly with a switch statement and using getfield instead of findstr, but the existing version should be fine.Now all this configuration is applied and it works, but the performance of CPUs is very high (CPU0: 80%, CPU1: 100%, AVERAGE: 90%). The main overhead is being introduced by ASM (we can see in ASM CPU Graphs), but it is only a 40 % of CPU0.
In 9.x, TMM doesn't provide reporting to the Linux host on how many cycles its using. So top and ps will show TMM using 50% of both CPUs (and 100% of CPU1). The performance graphs in the GUI or tmstat from the CLI will show more accurate usage for TMM.
Which processes on CPU0 are using the majority of the CPU cycles? Is it bd, mysql or learning_manager.pl? If it's bd or mysql, then there is cause for concern. learning_manager.pl is set to a lower CPU priority so it will give up cycles as standard priority processes require them.
How many HTTP requests per second did you have going through ASM or the unit in total while the BD CPU graph was showing ~60% load?
Aaron - Fernando_Martín
Nimbostratus
Which ASM version are you running (b version)?
BIG-IP Version is 9.4.7 330.35 and an HF2 and an engineering HFb version Kernel: Linux 2.4.21-9.4.7.320.0smp Package: BIG-IP Version 9.4.7 330.35 Hotfix HF2 Edition Hot fixes: CR100218 CR124714 CR125718 CR125853 CR126690 CR132165 CR132166 CR132167 CR132783
And which platform are you running ASM on (b platform | head)?
The results of command:b platform | head PLATFORM INFORMATION -- | Marketing Name: BIG-IP 8400 | BIOS Rev: AMIBIOS(C)2003 American Megatrends, Inc. 8400V BIOS Version: OBJ-0099-01 Rev. V8400V170 Date:12/09/2005 | base MAC: 00:01:D7:69:85:40 | PVA Version: 10 +-> SYSTEM INFO | Type: D84 | Chassis serial: bip237237s Level 200 part: 200-0242-15 REV A | Switch board serial: PCA0116MW6ED part: PCA-0116-05 REV A | Host board serial: FX070611O090051 part: MOB-0019-06 REV B
How many HTTP requests per second did you have going through ASM or the unit in total while the BD CPU graph was showing ~60% load?
We don't know exactly how many HTTP_requests/second. I attach a graph related with the traffic of the main web page... - hoolio
Cirrostratus
dupe - hoolio
Cirrostratus
Can you also check for info on these questions?
Which processes on CPU0 are using the majority of the CPU cycles? Is it bd, mysql or learning_manager.pl? If it's bd or mysql, then there is cause for concern. learning_manager.pl is set to a lower CPU priority so it will give up cycles as standard priority processes require them.
Thanks,
Aaron
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
