2013-10-28 44 views
0

我想你的幫助澄清這個n_gunzip我的清漆設置。清漆似乎在做gunzip很多

這些是我運行一些網站的服務器的統計數據。

34837   0.00   0.50 cache_hit - Cache hits 
    1022   0.00   0.01 cache_hitpass - Cache hits for pass 
    4672   0.00   0.07 cache_miss - Cache misses 
    2175   .   . n_expired - N expired objects 
     85   0.00   0.00 n_gzip - Gzip operations 
    3512   0.00   0.05 n_gunzip - Gunzip operations 

問題是我看到我認爲是很多gunzip,約7%的所有命中。我真的不相信用戶會使用不支持gzip的瀏覽器訪問我的網站,所以我不明白gunzip爲什麼會發生。

所有編碼在我的VCL我有相關的是以下幾點:

sub vcl_recv { 
    if (req.http.Accept-Encoding) { 
      if (req.http.Accept-Encoding ~ "gzip") { 
       # If the browser supports it, we'll use gzip. 
       set req.http.Accept-Encoding = "gzip"; 
      } 
      else if (req.http.Accept-Encoding ~ "deflate") { 
       # Next, try deflate if it is supported. 
       set req.http.Accept-Encoding = "deflate"; 
      } 
      else { 
       # Unknown algorithm. Remove it and send unencoded. 
       unset req.http.Accept-Encoding; 
      } 
     } 
... 

是我光油正常運作?這是正常的行爲嗎?

回答

2

Gunzip相當便宜,所以我不會爲你的流量水平擔心。

如果這是一個Varnish 3.0服務器,您可以安全地刪除vcl_recv中的Accept-Encoding清理。這將由Varnish本身在幕後完成。

至於根本原因,我的猜測是這是您的服務監控探針,忘記設置Accept-Encoding: gzip。您的探測網址(首頁/ favicon/probe.txt)存儲在Varnish中,並且這些重複的檢查會影響您的gzip速率。