Forum Discussion
James_Thomson
Employee
Nov 22, 2006Compress 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?
- JRahm
Admin
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 } }
- James_Thomson
Employee
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. - Steven_Lane_805Historic F5 Account
- James_Thomson
Employee
Its described in the two posts mentioned in the previous post:
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects