2011-08-27 78 views
5

我是一個清漆的新手。我已經成功安裝了它,現在它已經可以工作了,但是我需要一些知識淵博的人員提供關於服務器性能的指導。需要幫助分析VarnishStat結果

我讀過這篇文章 - http://kristianlyng.wordpress.com/2009/12/08/varnishstat-for-dummies/但我仍然不確定howz的服務器性能。

服務器自最近9個小時以來一直在運行。據我所知,隨着時間的推移,更多的內容會被緩存,所以緩存命中率會更好,但現在我的擔心是關於服務器性能方面的中間幫助。

Hitrate ratio:  10  100  613 
Hitrate avg:  0.2703 0.3429 0.4513 

     239479   8.00   7.99 client_conn - Client connections accepted 
     541129  13.00  18.06 client_req - Client requests received 
     157594   1.00   5.26 cache_hit - Cache hits 
      3   0.00   0.00 cache_hitpass - Cache hits for pass 
     313499   9.00  10.46 cache_miss - Cache misses 
     67377   4.00   2.25 backend_conn - Backend conn. success 
     316739   7.00  10.57 backend_reuse - Backend conn. reuses 
     910   0.00   0.03 backend_toolate - Backend conn. was closed 
     317652   8.00  10.60 backend_recycle - Backend conn. recycles 
     584   0.00   0.02 backend_retry - Backend conn. retry 
      3   0.00   0.00 fetch_head - Fetch head 
     314040   9.00  10.48 fetch_length - Fetch with Length 
     4139   0.00   0.14 fetch_chunked - Fetch chunked 
      5   0.00   0.00 fetch_close - Fetch wanted close 
     386   .   . n_sess_mem - N struct sess_mem 
      55   .   . n_sess - N struct sess 
     313452   .   . n_object - N struct object 
     313479   .   . n_objectcore - N struct objectcore 
     38474   .   . n_objecthead - N struct objecthead 
     368   .   . n_waitinglist - N struct waitinglist 
      12   .   . n_vbc - N struct vbc 
      61   .   . n_wrk - N worker threads 
     344   0.00   0.01 n_wrk_create - N worker threads created 
     2935   0.00   0.10 n_wrk_queued - N queued work requests 
      1   .   . n_backend - N backends 
      47   .   . n_expired - N expired objects 
     149425   .   . n_lru_moved - N LRU moved objects 
      1   0.00   0.00 losthdr - HTTP header overflows 
     461727  10.00  15.41 n_objwrite - Objects sent with write 
     239468   8.00   7.99 s_sess - Total Sessions 
     541129  13.00  18.06 s_req - Total Requests 
     64678   3.00   2.16 s_pipe - Total pipe 
     5346   0.00   0.18 s_pass - Total pass 
     318187   9.00  10.62 s_fetch - Total fetch 
    193589421  3895.84  6459.66 s_hdrbytes - Total header bytes 
    4931971067  14137.41 164569.09 s_bodybytes - Total body bytes 
     117585   3.00   3.92 sess_closed - Session Closed 
     2283   0.00   0.08 sess_pipeline - Session Pipeline 
     892   0.00   0.03 sess_readahead - Session Read Ahead 
     458468  10.00  15.30 sess_linger - Session Linger 
     414010   9.00  13.81 sess_herd - Session herd 
    36912073  880.96  1231.68 shm_records - SHM records 

回答

2

你在用什麼VCL?如果答案是'沒有',那麼你可能沒有得到很好的命中率。在全新安裝中,Varnish對於緩存的內容非常保守(正確),但您可以通過閱讀how to achieve a high hitrate來改善問題。如果安全,您可以選擇性地取消設置Cookie,並使用您的VCL規範請求,這將導致後端呼叫數量減少。

您的網站有多少可緩存?你的對象緩存足夠大嗎?如果你可以回答這兩個問題,你應該能夠對Varnish產生很大的衝擊。

+0

我正在使用VCL來僅緩存圖像和javascript以及css文件。由於該系統是由ZenCart的舊版本構建而成,因此效率不高,並會在每次請求時發送Cookie。我試圖去掉cookie並嘗試緩存其他頁面,但不幸的是,由於使用這些cookie,ZenCart做了很多事情,所以它產生了問題。現在我的緩存命中率是總請求的40%。我知道它不好,但它像什麼都比沒有好。 –

+2

在這種情況下,您應該查看Varnish,varnishhist varnishtop和varnishlog中包含的工具,以瞭解什麼是緩存以及是否可以改進任何內容。例如'varnishtop -i RxURL'會顯示請求的最高URL,下面給出所有緩存未命中的詳細信息: 'varnishlog -o VCL_call「^ miss」-i VCL_call,VCL_Return,ObjStatus,RxURL, Backend' – uknzguy