For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Diego_19194's avatar
Diego_19194
Icon for Nimbostratus rankNimbostratus
Aug 14, 2007

iRule limits

I am writing a iRule where check in a regexp a number in the mail message.

 

 

To do that, I used the command matches_regex but when I finished the regexp to add in the iRule, I found it is so big.

 

 

Could you tell me what is the regexp limit recommended to use in a iRule?

 

 

A text file with all regexp has a size of 500K. I can't upload in the forum because we have a limit of 100K.

16 Replies

  • I shared my script with you. This was wrote in perl and it is very efficient.

     

    About use switch/if statement, I think they are big values to do that. However, I can test it, but I need to write a new script to do that.

     

     

    My last questions, if anyone know, are what is the limit in performance to LTM? and Can we do a iRule that read an external file?

     

     

    Thanks
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    The iRule itself cannot live in an external file, but the datagroup(s) it references can.

     

     

    /deb
  • I tested some part with datagroup and I think it is the best way.

     

     

    Thanks to everyone for your help.

     

  • I believe iRules have an internal memory limit of 4MB. Thus, your regexp may cause an LTM failure if your regexp causes the iRule to consume more than 4MB of RAM. Please check the regex for greediness.
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Good point.

     

     

    The actual functional limit is more like 1MB of data after charset / encoding expansions take place.

     

     

    tcl requires contiguous memory allocation for such operations, and if the content against which you are running the regex is more than ~1MB or a large enough contiguous memory block cannot be allocated, you will definitely see page load failures, and extreme resource exhaustion from repeated allocation of large contiguous memory blocks can cause LTM to fail.

     

     

    (It's worth pointing out that the size of the iRule itself is not relevant to that limit, but may cause the config file to grow to an unmanageable size.)

     

     

    /deb
  • Deb

     

    How do you determine what your current memory allocation is? I have an iRule that uses several large class files and want to make sure we don't hit this limit.

     

     

    Thanks

     

    -L