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:
[
[email protected] ~]$ 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:
[
[email protected] ~]$ 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!