Forum Discussion

James_Thomson's avatar
Nov 22, 2006

Compress if RTT is above a certain amount

I'm trying to use the following iRule:


when HTTP_REQUEST {
  set rtt [TCP::rtt]
}
when HTTP_RESPONSE {
   if {$rtt < 1600 } {
      log "NOcompress rtt=[TCP::rtt]"
      COMPRESS::disable
   }
   elseif {$rtt > 1600 } {
      log "compress rtt=[TCP::rtt]"
      COMPRESS::enable
      COMPRESS::gzip level 9
   }
}

In my log, I see:

Nov 22 10:18:47 tmm tmm[754]: 01220002:6: Rule sel-compress : compress rtt=1323

Nov 22 10:18:48 tmm tmm[754]: 01220002:6: Rule sel-compress : compress rtt=1318

Nov 22 10:18:49 tmm tmm[754]: 01220002:6: Rule sel-compress : compress rtt=1310

Does this make any sense because it should only log "compress if the rtt is above 1600 right?

4 Replies

  • You are comparing on a stored value from the request, but logging the current value from the response. You could log both values to see if they are different:

    
    when HTTP_REQUEST {
      set rtt [TCP::rtt]
    }
    when HTTP_RESPONSE {
       if {$rtt < 1600 } {
          log "NOcompress rtt=[TCP::rtt], stored rtt=$rtt"
          COMPRESS::disable
       }
       elseif {$rtt > 1600 } {
          log "compress current rtt=[TCP::rtt], stored rtt=$rtt"
          COMPRESS::enable
          COMPRESS::gzip level 9
       }
    }
  • I thought that might be the case, so I started logging different values. It looks like I'm getting wildly different values for rtt depending on whether it is calculated in CLIENT_ACCEPTED or HTTP_REQUEST.

     

    I'll update when I hear back from support.
  • Steven_Lane_805's avatar
    Steven_Lane_805
    Historic F5 Account

     

    Can somebody explain exactly how the RTT function calculates round trip time.
  • Its described in the two posts mentioned in the previous post:

     

    http://devcentral.f5.com/Default.aspx?tabid=28&view=topic&forumid=5&postid=5380

     

    http://devcentral.f5.com/Default.aspx?tabid=28&view=topic&forumid=5&postid=1702