Forum Discussion

Eduardo_Saito_1's avatar
Eduardo_Saito_1
Icon for Nimbostratus rankNimbostratus
Dec 11, 2007

Regex taking 1% CPU - How to minimize CPU Load?

Hello Eveybody.

 

 

 

 

I'have an iRule that is working ok, but there is a regex thjat is taking 1% CPU on a 6400 BIG-IP.

 

 

 

How Can I minimize CPU load?

 

 

 

Here is the code:

 

 

The objective of this regex is to list all images (URI) of "http://image.domain.com" in the HTML code.

 

 


set image_match [regexp -all -inline -indices {http://image.domain.com/[a-zA-Z0-9/._-]+} [HTTP::payload]]    

 

 

 

Thanks!

 

 

Eduardo Saito

1 Reply

  • Hi Eduardo,

     

     

    A regex will eat up CPU no matter how streamlined you get it. You can probably save a bit of CPU time by escaping the periods with a backslash:

     

     

    http://image\.domain\.com/[a-zA-Z0-9/._-]+

     

     

    Depending on what you want to do with the image references, you might be able to replace the regexp with a stream profile. What are you actually doing with the indices once you get them?

     

     

    Aaron