gzip压缩增加了性能,最终增加了服务器的响应时间

这是我目前的服务器场景。

我在Rackspace Cloud实例(16GB内存)上运行,在CentOS 5.5安装上使用cPanel / WHM。

我目前正在运行大约10个Magento站点,大小各不相同(从中等大小)

随着时间的推移,我注意到网站速度放缓。 我已经对数据库和其他东西做了大量的调整,以帮助提高Magento的性能。

我最近通过为Apacheconfiguration添加以下Post Include来全局启用gzip压缩

<IfModule mod_deflate.c> # Insert filter on all content SetOutputFilter DEFLATE # Insert filter on selected content types only AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # 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 \bMSIE !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </IfModule> 

我立即注意到网站的加载时间更快,并且非常高兴。 但几分钟后,我注意到响应时间增加了,完全消除了性能提升,使站点比gzip多加载2-3秒。

我的理解是,gzip并不需要太多额外的CPU,但是通过10个不同的网站的组合,情况会是这样吗?

有没有办法让内容gzip一次,而不是让apache查找已经gzip的文件并使用它,而不是一遍又一遍地为每个请求压缩每个文件?

任何有识之士将不胜感激!

也许你可以看看mod_disk_cache

有一种方法来首先gzip你的内容,并用一些重写foo,做这个工作(在理论上)…但是,如果你对网站性能感兴趣,看看反向代理caching,如漆。 虽然我不与magento一起工作,但清漆似乎与它完美地结合在一起: http : //www.magentocommerce.com/magento-connect/pagecache-powered-by-varnish.html

HTH。