Please help testing gzip code in Varnish

Bedis 9 bedis9 at gmail.com
Tue Jan 25 22:38:11 CET 2011


On Wed, Jan 5, 2011 at 3:45 PM, Poul-Henning Kamp <phk at phk.freebsd.dk> wrote:
>
> I have added the first part of gzip support to varnish-trunk.
>
> This is new code with semi-twisted logic under the hood, so
> I am very dependent on you guys helping to test it out.
>
> If you set the paramter http_gzip_support to true, varnish
> will always send "Accept-encoding: gzip" to the backend.
>
> If the client does not understand gzip, varnish will gunzip
> the object during delivery.
>
> This means that you only will only cache the gzip'ed version of
> objects.
>
> The responsibility for gzip'ing the object is with your backend,
> Varnish doesnt don't know which objects you want to gzip and which
> not (ie: images: no, html: yes, but what about .cgi ?)
>
> ESI is not supported with gzip mode yet, that is the next and
> even more involved step.
>
> When you file tickets, please use "version = trunk" in trac
>
> Thanks in advance,
>
> Poul-Henning
>
> PS: Also be aware that "purge" is now called "ban" in -trunk.
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>



Hi,

I've tested the new http_gzip_support parameter.

First of all, I can confirm that an "Accept-Encoding: gzip" header is
well sent to the backend.

My VCL file is empty, I have just the vcl_recv tips to normalize the
Accept-Encoding:
backend www {
  .host = "127.0.0.1";
  .port = "81";
}

sub vcl_recv {
        ### parse accept encoding rulesets to normalize
        if (req.http.Accept-Encoding) {
                if (req.http.Accept-Encoding ~ "gzip") {
                        set req.http.Accept-Encoding = "gzip";
                } elsif (req.http.Accept-Encoding ~ "deflate") {
                        set req.http.Accept-Encoding = "deflate";
                } else {
                        # unkown algorithm
                        remove req.http.Accept-Encoding;
                }
        }
}

I ran two requests:
Req1: wget -S http://127.0.0.1:80/ --header="Accept-Encoding: gzip"
Req2: wget -S http://127.0.0.1:80/

For both requests:
 - I had a MISS from Varnish.
 - Varnish sent a "Accept-Encoding: gzip" header (looks normal)

For the first request, I got a gzipped file while I got a HTML flat
file for the second.
Everything seems to work as expected.

I just wonder why the second request is a MISS while the gzipped
object is already in memory.
Can't Varnish use it to deliver a gunzipped object?
(I know it will break the Vary: Accept-Encoding rule)

cheers




More information about the varnish-misc mailing list