Forum Discussion
Best practive for iRules-LX calls with a proc
Such an interesting question. It seems the last post does not answer the question.
I tried this code:
proc global_init_proc {handler} {
ILX::call $handler -timeout 12000 HelloWorld
}
proc per_call_init_proc {} {
set rpc_handle [ ILX::init HelloWorld HelloWorld ]
ILX::call $rpc_handle -timeout 12000 HelloWorld
}
when RULE_INIT {
set static::ilx_init_perf_report_loop 1000
}
when HTTP_REQUEST {
set global_rpc_handle [ ILX::init HelloWorld HelloWorld ]
set start [clock clicks]
for {set i 0} {$i<$static::ilx_init_perf_report_loop } {incr i} {
call global_init_proc $global_rpc_handle
}
set stop [clock clicks]
set global_ilx_init_clicks [expr {$stop - $start}]
set start [clock clicks]
for {set i 0} {$i<$static::ilx_init_perf_report_loop } {incr i} {
call per_call_init_proc
}
set stop [clock clicks]
set per_proc_ilx_init_clicks [expr {$stop - $start}]
HTTP::respond 200 content "
ILX Init Performance Report
ILX calls executed : $static::ilx_init_perf_report_loop times
when ILX init is done once : $global_ilx_init_clicks clicks
when ILX init is done in each call : $per_proc_ilx_init_clicks clicks
" noserver
}with ILX code:
var f5 = require('f5-nodejs');
var ilx = new f5.ILXServer();
ilx.addMethod('HelloWorld', function(req, res) {
res.reply("Hellow World");
});
ilx.listen();This code execute 1000 times the proc running ILX for each scenario (ILX init in each proc or global)
here is the result:
$ curl http://192.168.2.11
ILX Init Performance Report
ILX calls executed : 1000 times
when ILX init is done once : 283381 clicks
when ILX init is done in each call : 289762 clicks
$ curl http://192.168.2.11
ILX Init Performance Report
ILX calls executed : 1000 times
when ILX init is done once : 280417 clicks
when ILX init is done in each call : 281854 clicks
$ curl http://192.168.2.11
ILX Init Performance Report
ILX calls executed : 1000 times
when ILX init is done once : 281807 clicks
when ILX init is done in each call : 285148 clicks
So we can say that the ILX init in each proc call uses a little more clicks than a global ILX Init.
but when running only 10 times the proc:
$ curl http://192.168.2.11
ILX Init Performance Report
ILX calls executed : 10 times
when ILX init is done once : 3701 clicks
when ILX init is done in each call : 2841 clicks
$ curl http://192.168.2.11
ILX Init Performance Report
ILX calls executed : 10 times
when ILX init is done once : 10398 clicks
when ILX init is done in each call : 10427 clicks
$ curl http://192.168.2.11
ILX Init Performance Report
ILX calls executed : 10 times
when ILX init is done once : 3073 clicks
when ILX init is done in each call : 2822 clicks
The the ILX init in each proc call is faster than global init.
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
