Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm refactoring my Varnish VCL and can't figure out this one thing.

Varnish 3.0 natively supports gzipped content, and it essentially seems to do the right thing. See also: http://stackoverflow.com/a/12962493/35434

However, Varnish still performs a gunzip step, according to varnishlog, even though the client requests gzipped content and the backend responds with gzipped content. According to the Varnish docs, Varnish defaults to do_gzip=true, and also stores cache-objects compressed. So, why the gunzip?

Here are the relevant log entries:

11 RxURL        c /javascripts/general.js
11 RxHeader     c Accept-Encoding: deflate, gzip
11 VCL_call     c fetch
13 TxHeader     b Accept-Encoding: gzip
13 RxHeader     b Content-Encoding: gzip
13 RxHeader     b Content-Type: application/javascript
11 Gzip         c u F - 1554 4476 80 80 12365
11 VCL_call     c deliver
11 TxHeader     c Content-Encoding: gzip

As you can see, the entire pipeline supports gzip, yet Varnish performs a gunzip during vcl_fetch. I have the assume it stores the objects compressed, and as you can see it delivers it compressed as well.

After this request, varnishstat shows the gunzip operation occurred:

$ varnishstat -1 | grep zip
n_gzip                       0         0.00 Gzip operations
n_gunzip                     1         0.00 Gunzip operations

Note: My VCL has no gzip configuration at all, nor do I do anything with the object's body. I'm relying on the sensible defaults, hence I'm not showing the VCL.

A gunzip operation is relatively light, but I'd still like to understand why, and possibly prevent a few hundred-thousand operations.

share|improve this question
    
I can see the same problem. –  Moshe L Feb 16 '13 at 19:46
add comment

1 Answer

Can you please set this into your vcl_fetch() section

set beresp.do_gunzip = false;

This should stop varnish doing the gzip.

share|improve this answer
1  
I did as you said but it performs exactly the same. According to the docs, false is the default already: "beresp.do_gunzip: Boolean. Unzip the object before storing it in the cache. Defaults to false." –  Martijn Heemels Jan 10 '13 at 13:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.