您的位置:首页 > 运维架构 > Apache

Apache页面压缩配置问题导致json数据传输时间延长

2013-06-03 18:03 1001 查看
为加快js文件的下载速度,启用了apache服务器的页面压缩功能。

LoadModule deflate_module modules/mod_deflate.so

......

<IfModule deflate_module>

DeflateCompressionLevel 9

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php

AddOutputFilter DEFLATE css js

</IfModule>

发现ext-all.js等js文件的传输时间明显减少,但是查询服务器返回json数据时间大大延长,原来每次大约为100ms,现在每次大约为5.5秒。

经过追踪,发现原因是apache压缩配置,改为

<IfModule deflate_module>

DeflateCompressionLevel 9

#AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php

#AddOutputFilterByType DEFLATE text/html

#AddOutputFilterByType DEFLATE text/json application/json text/x-json application/x-json

AddOutputFilterByType DEFLATE text/json

AddOutputFilter DEFLATE css js

</IfModule>

这样可能牺牲部分文件的传输速度,但json数据的速度明显加快。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐