Forum Discussion

Photo_G_84660's avatar
Photo_G_84660
Icon for Nimbostratus rankNimbostratus
Jul 07, 2006

Array element limitation question

Hi,

I'd like to ask whether there is a limit to the maximum number of elements that an iRule array can store and parse. I’m curious, because I'd like to understand the impact of utilizing the following modified version of the LimitConnectionsFromClient iRule found at: http://devcentral.f5.com/wiki/default.aspx/iRules/LimitConnectionsFromClient.html. This looks like an excellent way to throttle connections to a VIP, but I'm concerned that it might also create a massive array that drives the BIG-IP CPU into the ground. Any input would be appreciated.


when RULE_INIT {    
   array set ::active_clients { } 
  }    
 when CLIENT_ACCEPTED {    
   set client_ip [IP::remote_addr]    
   if { [info exists ::active_clients($client_ip)] } { 
     if  {$::active_clients($client_ip) > 5 } { 
       log "$client_ip has exceeded the SLA"    
       reject
       event CLIENT_CLOSED disable    
       return    
     } else { 
       log local0. "$::active_clients($client_ip)" 
       incr  ::active_clients($client_ip) 
     } 
   } else { 
     set ::active_clients($client_ip) 1 
   } 
 }    
 when CLIENT_CLOSED {    
   if { [info exists ::active_clients($client_ip)] } {    
     incr ::active_clients($client_ip) -1    
     if { $::active_clients($client_ip) <= 0 } {    
       unset ::active_clients($client_ip)    
     }    
   }    
 }

Thanks in advance,

Scott H.