Forum Discussion
Robert_47833
Sep 29, 2011Altostratus
set variables or not,this is the question
I want to redirect http://www.cjj.co.uk to http://my.cjj.co.uk http://www.cjj.com to http://my.cjj.com
hmm
there are 2 ways to achieve this ,one use variable ,another one does...
Michael_Yates
Sep 29, 2011Nimbostratus
Hi Jucao,
That article is a list of best practices to write the most efficient iRules possible.
You may ask yourself: "Self, who cares about a spare 30 bytes or so?" Well, for a single connection, it's likely no big deal but you need to think in terms of 100's of 1000's of connections per second. That's where even the smallest amount of overhead you can save will add up. Removing those variables could gain you a couple thousand connections per second on your application.
And never fear, there is no more overhead in using the builtin commands like ]HTTP::host[ over a varable reference as both are just direct pointers to the data in memory.
You just have ask yourself if you are willing to sacrifice the efficiency for ease of management. Sometimes the answer is yes when you are dealing with a really large and complex iRule, but most of the time the answer can easily be no.
The proof is in the pudding as they say. I would suggest doing what Hamish suggested and using the timing command to find out which of the two is more efficient (in your iRule I think that the difference is going to be extremely small, but like the tech tip said, a minor difference can become major when you multiply it times 100 or 1000 connections per second).
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