Forum Discussion

Leslie_South_55's avatar
Leslie_South_55
Icon for Nimbostratus rankNimbostratus
Sep 20, 2007

Use iControl to manage an external class file

I have the need to use the HTTP::redirect function to handle the request for over 5000 + URL's. I am planning to use an external class file to store the redirects. The client has the requirement to manage these redirects "at will" via a simple user interface. My questions are as follows:

 

 

1) Can I use iControl to manage an external class file to provide a GUI to add, delete, or modify redirects?

 

 

2) How will my 6400 dual proc box respond having to read through a 5000+ line redirects file?

 

 

Many thanks, in advance.

 

-L

6 Replies

  • 1) Can I use iControl to manage an external class file to provide a GUI to add, delete, or modify redirects?

     

     

    Absolutely, but with some restrictions. You'll have to use the System::ConfigSync::download_file() and upload_file() methods to download and upload the external data group. These is typically stored in the "/config" directory. There is no line-by-line access so you'll have to manage the file contents on the machine running the iControl application. In short, just treat the external class file as any other file you would upload/download from the device.

     

     

    One thing to take note of here is that the file is only loaded at RULE_INIT time so if you change the contents of the external data group, you will have to tweak your iRule (add a space) and resave it to force a new rule initialization. These sample code apps might be of relevance.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iControl/InitializeRule.html Click here

     

    http://devcentral.f5.com/wiki/default.aspx/iControl/PingExternalClass.html Click here

     

     

     

    2) How will my 6400 dual proc box respond having to read through a 5000+ line redirects file?

     

     

    That entirely depends on what your iRule is doing with those 5000 lines and how often the iRule is getting executed. I personally don't have performance impact numbers for very large classes, I do know that we have customers doing blacklisting type appliations with them and they are running successfully. So, if you device is at 90% capactity before the iRule, odds are you'll hit some issues. A 6400 is a pretty beefy device, so odds are there should be no issues with overhead.

     

     

    One thing to note regarding performance and very large data groups. Make sure you do not use the TCL list commands on this (like llength, or lindex) as those will "morph" the optimized hash that we use to a true TCL list for which access is much slower. For smaller lists, this isn't an issue, but for larger ones, it could be.

     

     

    Hope this helps...

     

     

    -Joe
  • Patrick_Chang_7's avatar
    Patrick_Chang_7
    Historic F5 Account
    would it be possible to construct the data group in such a way that it could be used as a TCL associative array within the iRule? This would make the performance hit grow roughly linearly with the size of the data group.
  • Joe- do you have any examples of iRules using external classes for data?

     

     

    You mentioned a few customers having done this.
  • Using an external class from within an iRule is no different than using a "internal" class. You can use the findclass or matchclass methods to do lookups in those data groups. The only real difference is that external data groups are stored in files on the file system. They are mainly used for very large lists (ie, blacklist looksups) where management from the GUI's listboxes would be unusable.

     

     

    What specifically were you looking for? If it's just how to use matchclass/findclass you should be able to find examples in the wiki.

     

     

    -Joe
  • Oh, gotcha... There are no API methods to add/remove content from external files. You have to treat them like single files and upload and download them with the System.ConfigSync.upload_file() and download_file() methods and edit the contents on your client machine.

     

     

    -Joe