Forum Discussion
How to get the response size after gzip compression
Hi, i have virtual server that run HTTP Compression Profile i need to get the size of the response packet after the gzip compression before it leave the f5 machine
i try the fallow irule
when HTTP_RESPONSE { log local0. "HTTP_RESPONSE triggered" HTTP::collect 32000000 set length [HTTP::payload length] HTTP::header insert "Content-Length" $length log local0. "the content length of the response from OWS is $length" } but i get the size before compression
i check the size its need to be with the fallow command from tmsh
tmsh show ltm profile http-compression profile_name
i will appreciate your help thanks
3 Replies
- crodriguezRet. Employee
What version of BIG-IP are you running? The reason I ask is because, in later versions of BIG-IP, you should not have to insert a Content Length header with the compressed payload size on the client-side response. The BIG-IP system takes care of that for you. Is there a separate reason why you are inserting a Content Length header in the iRule?
- TalNe
Nimbostratus
Hi Im the version of f5 is 12.1 The resone is we using external log system with hsl and i need to know the size of the response that we send to the log system after it been gzip
Hi Talne,
if the responce content is not
, then you may use the Content-Length header value of thechunked
event. Below is a simple iRule which analyses the Content-Length duringHTTP_RESPONSE_RELEASE
andHTTP_RESPONSE
event and then performs rocket science to output the compression ratio...HTTP_RESPONSE_RELEASEwhen HTTP_REQUEST { set http_path [HTTP::path] } when HTTP_RESPONSE { set content_l [HTTP::header value "Content-Length"] } when HTTP_RESPONSE_RELEASE { if { ( [HTTP::header value "Content-Length"] ne "" ) and ( $content_l ne [HTTP::header value "Content-Length"] ) } then { log local0.debug "Path: $http_path Comperssion Ratio: [expr { [HTTP::header value "Content-Length"] / ( $content_l / 100 ) }]%" } }Note: If you need to analyse the compression ratio of chunked content, then you could experiment with a VIP-targeting-VIP setup where the serverside VIP compresses the content and the clientside VIP analyses the transmited payload of the serverside VIP.
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
