2016-07-07 111 views
0

我有一个简单的系统缓存,我想知道当我压缩这个缓存文件夹中的每个文件和请求页面时,我解压缩并发送它,这个操作是否影响速度?并会消耗更多的内存资源?关于压缩缓存文件

注:我们的目标是节省空间


感谢

+0

阿帕奇已经有处理这 – unixmiah

+0

这听起来像他做mod_deflate模块的另一模块文件。就像他正在压缩缓存文件以节省服务器硬盘驱动器上的空间,然后将它们解压缩一样。 – stevecomrie

+0

我很无能。不知道他想要完成什么。 – unixmiah

回答

0

你手工荏苒服务器上的缓存文件,然后手动解压它们并将它们发送回浏览器,因为它们是要求?

是的,这会对产生负面影响会影响您的表现。

相反,考虑使用类似mod_deflate的东西来自动缩小文件的大小,当它们发送到浏览器。

0

如果你正在运行的Apache Web服务器,就可以进入下面的一组代码到你的.htaccess或Apache的conf文件,或与在线工具检查,如果这是工作或没有

<IfModule mod_deflate.c> 
    SetOutputFilter DEFLATE 
    <IfModule mod_setenvif.c> 
     # 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 

     # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 
     # the above regex won't work. You can use the following 
     # workaround to get the desired effect: 
     BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 

     # Don't compress images 
     SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary 
    </IfModule> 
    <IfModule mod_headers.c> 
     # Make sure proxies don't deliver the wrong content 
     Header append Vary User-Agent env=!dont-vary 
    </IfModule> 
</IfModule> 

您可以调整并调整设置缓存,在命令行中,你可以检查它是否荏苒

curl -I -H 'Accept-Encoding: gzip,deflate' www.domain.com