由于squid 2.x不支持http1.1,所以对gzip压缩过的内容和不压缩的内容缓存并不能很好的缓存两份。
varnish是一个纯缓存产品,性能据说要高于squid。
本文只是测试了varnish缓存gzip压缩方面的支持,安装和设置请参考
[url]http://blog.s135.com/post/313/[/url]
用curl请求未压缩的内容:
[quote]curl http://192.168.0.24:83/index.do -I[/quote]
[quote]
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: max-age=300
Last-Modified: Wed, 25 Mar 2009 06:53:43 GMT
Content-Type: text/html;charset=utf-8
Content-Language: zh-CN
Content-Length: 38491
Date: Wed, 25 Mar 2009 06:54:32 GMT
X-Varnish: 1572495328 1572495325
Age: 52
Via: 1.1 varnish
Connection: keep-alive
[/quote]
请求压缩的内容:
[quote] curl http://192.168.0.24:83/index.do -H Accept-Encoding:gzip,defalte -I[/quote]
[quote]HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: max-age=300
Last-Modified: Wed, 25 Mar 2009 06:53:23 GMT
Content-Type: text/html;charset=utf-8
Content-Language: zh-CN
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 9436
Date: Wed, 25 Mar 2009 06:54:49 GMT
X-Varnish: 1572495346 1572495323
Age: 83
Via: 1.1 varnish
Connection: keep-alive
[/quote]
从返回的response head中很容易就能分辨varnish缓存了两份index.do
并且缓存的命中情况可以通过varnishstat查看
[img]http://lveyo.iteye.com/upload/picture/pic/34073/b289049a-eac8-38fb-99d8-9d1a2f72c44c.jpg[/img]
varnish是一个纯缓存产品,性能据说要高于squid。
本文只是测试了varnish缓存gzip压缩方面的支持,安装和设置请参考
[url]http://blog.s135.com/post/313/[/url]
用curl请求未压缩的内容:
[quote]curl http://192.168.0.24:83/index.do -I[/quote]
[quote]
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: max-age=300
Last-Modified: Wed, 25 Mar 2009 06:53:43 GMT
Content-Type: text/html;charset=utf-8
Content-Language: zh-CN
Content-Length: 38491
Date: Wed, 25 Mar 2009 06:54:32 GMT
X-Varnish: 1572495328 1572495325
Age: 52
Via: 1.1 varnish
Connection: keep-alive
[/quote]
请求压缩的内容:
[quote] curl http://192.168.0.24:83/index.do -H Accept-Encoding:gzip,defalte -I[/quote]
[quote]HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: max-age=300
Last-Modified: Wed, 25 Mar 2009 06:53:23 GMT
Content-Type: text/html;charset=utf-8
Content-Language: zh-CN
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 9436
Date: Wed, 25 Mar 2009 06:54:49 GMT
X-Varnish: 1572495346 1572495323
Age: 83
Via: 1.1 varnish
Connection: keep-alive
[/quote]
从返回的response head中很容易就能分辨varnish缓存了两份index.do
并且缓存的命中情况可以通过varnishstat查看
[img]http://lveyo.iteye.com/upload/picture/pic/34073/b289049a-eac8-38fb-99d8-9d1a2f72c44c.jpg[/img]