用 curl 测试 tomcat response compressed effects

  tomcat conf response content compression off:
  compression="off"   compressionMinSize="2048" 
 noCompressionUserAgents="gozilla, traviata" 
 compressableMimeType="text/html,text/xml,text/plain,application/json"
 URIEncoding="UTF-8" 

Test non-compressed output size:
[mingdong.cheng@l-web1.dev.cn1 ~]$ curl  --compressed  -o  123.txt -v 'http://web1.abc.com/interface/international/XXXXX/getXXXXXXXXX.do?username=XXX&password=XXX&startTime=2011-12-01%200:00:00&endTime=2012-01-01%200:00:00'
* About to connect() to web1.abc.com port 80
*   Trying 192.168.126.118... connected
* Connected to web1.abc.com (192.168.126.118) port 80
> GET interface/international/XXXXX/getXXXXXXXXX.do?username=XXX&password=XXX&startTime=2011-12-01%200:00:00&endTime=2012-01-01%200:00:00 HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: web1.abc.com
> Accept: */*
> Accept-Encoding: deflate, gzip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                                   Dload  Upload   Total    Spent    Left      Speed
  0     0          0     0      0    0        0        0 --:--:--  0:00:10 --:--:--     0< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 30 Mar 2012 06:20:34 GMT
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Set-Cookie: QN29=XXXXXXXXXXXXXX; Expires=Mon, 28-Mar-2022 06:15:11 GMT; Path=/
100 9938k    0 9938k    0     0    903k      0 --:--:--  0:00:11 --:--:-- 2485k* Connection #0 to host web1.abc.com left intact

 
 tomcat conf response content compression on:
 compression="on"   compressionMinSize="2048" 
 noCompressionUserAgents="gozilla, traviata" 
 compressableMimeType="text/html,text/xml,text/plain,application/json"
 URIEncoding="UTF-8"

Test compressed output size:
[mingdong.cheng@l-web1.dev.cn1 ~]$ curl  -H "Accept-Encoding: deflate, gzip" -o 123.txt -v 'http://web1.abc.com/interface/international/XXXXX/getXXXXXXXXX.do?username=XXX&password=XXX&startTime=2011-12-01%200:00:00&endTime=2012-01-01%200:00:00'
* About to connect() to web1.abc.com port 80
*   Trying 192.168.126.118... connected
* Connected to web1.abc.com (192.168.126.118) port 80
> GET interface/international/XXXXX/getXXXXXXXXX.do?username=XXX&password=XXX&startTime=2011-12-01%200:00:00&endTime=2012-01-01%200:00:00 HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: web1.abc.com
> Accept: */*
> Accept-Encoding: deflate, gzip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                                   Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:10 --:--:--     0< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 30 Mar 2012 06:11:42 GMT
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Set-Cookie: QN29= XXXXXXXXXXXXXX ; Expires=Mon, 28-Mar-2022 06:06:19 GMT; Path=/
< Content-Encoding: gzip
< Vary: Accept-Encoding
100  786k    0  786k    0     0  76278      0 --:--:--  0:00:10 --:--:--  172k* Connection #0 to host web1.abc.com left intact

评测效果:  non- compressed response content  大小为9.8M的json,用gzip格式compressed 后 response content   大小为786K!

转载于:https://my.oschina.net/mingdongcheng/blog/51986

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值