Varnish will hold compressed obj in Cache, but when client don't support gzip.
How does Varnish deal with it? Does it hold the other uncompressed obj in Cache too, or decompress the compressed obj?
Varnish will hold compressed obj in Cache, but when client don't support gzip.
How does Varnish deal with it? Does it hold the other uncompressed obj in Cache too, or decompress the compressed obj?
Varnish 3.0 supports Gzip as mentioned in the "Compression" chapter of the official tutorial. All HTTP requests to the backend will include a request for gzipped content, so by default all objects are stored in memory gzipped.
If the backend does not support gzip, you can ask Varnish to compress the response before storing it by setting beresp.do_gzip
in vcl_fetch
.
If a request comes in from a client that does not support gzip, Varnish will gunzip the stored object before delivering it.
Varnish 2.x does not compress or de-compress: if the client supports Gzip, it will hold a gzipped version of the page in cache. If the client does not support it, another copy will be placed in the cache for the plain-content, without compression.
So yes: depending on the Accept-Encoding header (which should be normalized), multiple version of a page will be held in cache for each supported compression algoritme.
*Updated: editted for clarity, the above is for Varnish 2.0 or 2.1 only. Varnish 3.x supports gzip, as explained above.