Post of the Week: HTTP Redirect using Datagroups
In this "Post of the Week" video, we discuss HTTP redirects and how to use datagroups and iRules to do these redirects. If you have lots of URLs to redirect, then you might want to consider using something like this. Enjoy!
Resources
Developing iRules for BIG-IPHi John, I think this is a great idea. Instead of building and managing many many of specific redirection iRule or Local Traffic Policy or HTTP class, we simply build one REDIRECT datatroup and corresponding iRule and use it.
One quick question I have is if datagroup size is getting bigger and bigger, say 1000, there is any performance degradation compared to 1000 iRules or Local Traffic Policies? Any criteria when to create another redirection datagroup?
Thank you.
- imeliran
Nimbostratus
Hi john, thanks for sharing the post, i have a question regarding the redirect, i can implement the same idea but instead of 1 value of redirection i have like 3-4. i mean when my vip for exmaple is: maincdn.mydomain01.com and my redirection occur between cdn1.mydomain01.com , cdn2.mydomain01.com etc..
and the purpose of working with datagroup that for scalability, once i want to implement same redirection to second domain for example: vip maincdn.mydomain02.com and redirection occur between cdn1.mydomain02.com , cdn2.mydomain02.com etc..
thanks in advance
- ltwagnonRet. Employee
@F5_Digger, great question! The way that the "class" command works in a datagroup is that it hashes the entire datagroup before it searches, so the number of entries in the datagroup doesn't affect the performance too terribly bad. That said, we've done some testing on performance using datagroups and here's some of the results:
Testing done using 10,000 CPS, 1 HTTP request per TCP connection.
Baseline: TCP + HTTP profile + Blank iRule (when RULE_INIT { } )
Baseline results: Total CPU % used = 23%; TMM CPU % used = 16%; TMM Mem (MB) = 254
Check using iRule that I used in the video against datagroup with 1,000 entries (and no match found, so the entire group is forced to be searched).
Check against datagroup with 2,000 entries (no match found).
Results: Total CPU % used = 25%; TMM CPU % used = 18%; TMM Mem (MB) = 261
Check against datagroup with 10,000 entries (no match found).
Results: Total CPU % used = 26%; TMM CPU % used = 18%; TMM Mem (MB) = 277
So, even with a datagroup with 10,000 entries, the performance hit is minimal compared to a straight baseline with a blank iRule. I hope this helps!
- ltwagnonRet. Employee
@imeliran, thanks for the question. It's true that you can have more than one entry for the "value" portion of the datagroup entry, but you will need some kind of logic to handle the selection of the specific value entry once you match the datagroup key. For example, if you have a datagroup string that is "; and values for that string ", , ; then you would need something in your iRule to manipulate the values so that you can select the proper value to return. I hope this helps. If you have any other questions, let me know. Thanks!
- dragonflymr
Cirrostratus
Hi John,
As usual great article. One thing that makes this solution a bit cumbersome is lack of search/filter in datagroup interface (or I am not aware of such functionality?).
If there are hundreds or thousands of entries in datagroup it's hard to find the right one (to modify/delete) or check if given entry is already there. Any tips how to solve this?
I wonder as well how fast update in datagroup is picked up by iRule. I suspect that datagroup is not somehow cached when TCP connection is created and when HTTP_REQUEST is fired (can be multiple in one TCP connection) actual up-to-date content of datagroup is searched - Am I right?
Piotr
- Stanislas_Piro2
Cumulonimbus
@piotr, you can use external datagroup!
First time, you have to upload file. Next times, you can edit it in the webui!
- dragonflymr
Cirrostratus
Hi Stanislas,
Maybe I am missing something but how using external datagroup will help with checking/modifying entries after import? In GUI there is nothing for searching filtering datagroup entries - is that different for external datagroup?
Piotr
- Stanislas_Piro2
Cumulonimbus
when editing external Datagroup, this is a field to edit the whole DG like irules. the DG format is:
"param1" := "value1", "param2" := "value2", "param3" := "value3",
So to search a value in thousand values, you can easily copy in text editor or use browser search tool.
- dragonflymr
Cirrostratus
Thanks for example and explanation, that is kind of solution but it would be nice to have some tools in GUI to perform such task without external tools :-)
Piotr
- Reddy1
Altostratus
Instead a Redirect , If i need to modify the URI/PATH and send it to the pool ?