Mod deflate:在httpd.conf中启用压缩后,服务器占用更多资源



我在httpd.conf

中添加了以下代码段
 # mod_deflate configuration
<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
# Level of compression (Highest 9 - Lowest 1)
DeflateCompressionLevel 1
# Netscape 4.x has some problems.
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>

压缩工作绝对很好,但是服务器花了太长时间来响应请求,我也检查了top命令,它显示了99%的cpu使用率。如何使压缩更有效?或者其他在进一步分析时可能方便的命令吗?

如果响应是可缓存的,添加mod_expires和mod_cache+mod_disk_cache来动态缓存压缩后的变量

相关内容

最新更新