Forum Discussion
Brian_Ott_11267
Nimbostratus
Feb 03, 2005Compression based on client
Is it possible to construct an iRule to turn on compression based on a client's speed?
We find compression to be much less effective for many of our customers, and would like to turn it on for slower customers such as those on dialup and possible 256k/lower DSL.
Any thoughts in regards to how to determine the client's possible speed? Based on mss or mtu is my only idea.
This was one of the selling points for us in regards to the 3400 box, so I was curious what the most effective way to implement this might be.
-Brian.
9 Replies
- rapmaster_c_127Historic F5 AccountYes, you can definitely do this. Here are some commands that you could use to help determine the type of client. We have been working on improving some of them in 9.0.5, so you may want to hold off on getting too elaborate with them until then.
IP::hops
This gives you the estimated number of hops the peer takes to get to you.
TCP::rtt
This gives you the smoothed round-trip time estimate between you and the peer. Note that as an implementation detail, the unit is in 1/32 of a millisecond. (Sorry, that's a kernel implementation detail we had to use to avoid floating point.)
Note that the rtt takes some time to converge, so we have the following in order to cull outliers:
ROUTE::rttvar
This is the statistical variance of rtt in 1/16 ms intervals.
TCP::bandwidth
This is an estimate of the upload bandwidth (i.e. how much data we can optimally push to the peer without causing recoveries or drops) in bytes per second. Note: due to a bug in our implementation, this value is incorrect in current releases. It has been fixed for 9.0.5.
And, as you mentioned, we of course have:
TCP::mss
With these metrics, you can imagine just how good the possibilities are for traffic analysis. Of course, you can also use things like
IP::tos
To both get and set the diffserv parameters for traffic, if you have upstream devices doing traffic classification for you.
Here is a simple rule example using TCP::mss that disables compression to larger MSS clients (you must have it enabled on the profile, so the rule can only disable it.)when HTTP_REQUEST { if { [TCP::mss] >= 1280 } { COMPRESS::disable } }
Let us know how it goes, and please feel free to post your suggestions and enhancements! - Brian_Ott_11267
Nimbostratus
I thank you for the reply. I will see what I can do. - jwhitepnv_12764
Nimbostratus
I tried the following and got the following error. How do I change the HTTP profile?
when CLIENT_DATA {
if { [TCP::rtt] >= 1000 } {
profile HTTP_maxcompress
} elseif { [TCP::rtt] >= 500 } {
profile HTTP_mincompress
} else {
profile HTTP
}
}
01070151:3: Rule [Rap_iRule] error:
line 3: [undefined procedure: profile] [profile HTTP_maxcompress] - bl0ndie_127134Historic F5 AccountWe don't allow you to switch http profiles from rules. If you are trying to set the compression level dynamically, you may be able achieve the same thing using this rule
where '9' is a value at which you get the highest level of compression. You can call this rule as many times as you like and the value is sticky for the life time of that connection.COMPRESS::gzip level [ 1 .. 10 ] - rapmaster_c_127Historic F5 AccountI think you want to latch HTTP_REQUEST rather than CLIENT_DATA. CLIENT_DATA occurs after a TCP::collect rule, which may or may not have triggered any HTTP events. The safest place to check this metric is in HTTP_REQUEST.
- bl0ndie_127134Historic F5 AccountCorrection, the rule should read
Actually, I would have preferred '11' but oh well.COMPRESS::gzip level [ 1 .. 9 ] - tordofm_93708
Nimbostratus
Hi,
Can you confirm if the F5 LB's support the option to route traffic based on a diffserve value? I would look to have the value set by another system downstream.
Thanks
Marc - JRahm
Admin
Yes, if you use the IP::tos and/or LINK::qos
http://devcentral.f5.com/wiki/default.aspx/iRules/IP__tos.html Click here
http://devcentral.f5.com/Wiki/default.aspx/iRules/LINK__qos.html Click here - tordofm_93708
Nimbostratus
Thanks very Much
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
