由于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]
本文通过对比测试展示了Varnish对于GZIP压缩内容的良好支持,包括未压缩及压缩后的网页内容缓存表现,并提供了具体的响应头信息。
1001

被折叠的 条评论
为什么被折叠?



