测试varnish对gzip压缩内容的缓存

由于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]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值