java技術研究

          統計

          留言簿(3)

          閱讀排行榜

          評論排行榜

          Varnish研究(轉)

          麻煩你再研究一下Varnish,我所希望了解的事項是:
          1、 能否設置到URL級別。
          你可以以針對“2012潮流”頁面的這兩個鏈接進行測試:
          [IP]:[Port]/trend.html
          [IP]:[Port]/trend/findViewHotItemsAjax.html
          注意兩個鏈接后面均可能存在參數,
          比如[IP]:[Port]/trend/findViewHotItemsAjax.html?ref=1&np=1
          這些參數是查詢條件。

          可以支持,通過正則表達式區分路徑,可以通配到URL級別的訪問,在定義了路徑后設置一些屬性。

          2、 能否支持通配符
          比如
          [IP]:[Port]/trend*

          支持

          3、能否就每一個獨立配置設置獨立的緩存時間?
          我指的每一個獨立配置是指比如某個URL。
          比如 /trend.html 緩存4分鐘,而另外一個/trend/newest.html則緩存2分鐘。

          如果不行,那么Varnish的緩存時間允許怎么設置?
           
          可以做到對于不同路徑的緩存時間特性設置,但是需要在VCL語言中編寫,類似C的語言,按照業務需求來寫配置文件和處理流程……

          4、 清除Varnish緩存的命令是?
          方便做build后,人工或者通過腳本來調用該命令清除Varnish緩存。
          首先是要設置了管理的IP,通過Varnish管理端口,使用正則表達式批量清除緩存:
          (1)、例:清除類似
          http://www.elain.org/download/111.html的URL地址):
          /elain/apps/varnish/bin/varnishadm -T 172.16.2.223:3500 url.purge /download/
          (2)、例:清除類似
          http://www.elain.org/dl 的URL地址:
          /elain/apps/varnish/bin/varnishadm -T 172.16.2.223:3500 url.purge w*$
          (3)、例:清除所有緩存:
          /elain/apps/varnish/bin/varnishadm -T 172.16.2.223:3500 url.purge *$

          5、 如何監控Varnish,有可視化界面查看運行狀態,命中率等等嗎?
          1、查看Varnish服務器連接數與命中率:
          /elain/apps/varnish/bin/varnishstat
          cache_hit是命中率
          2、通過Varnish管理端口進行管理:
          用help看看可以使用哪些Varnish命令:
          /elain/apps/varnish/bin/varnishadm -T 172.16.2.223:3500 help
          [root@vanish ~]# /elain/apps/varnish/bin/varnishadm -T 172.16.2.223:3500 help
          help [command]
          ping [timestamp]
          auth response
          quit
          banner
          status
          start
          stop
          stats
          vcl.load <configname> <filename>
          vcl.inline <configname> <quoted_VCLstring>
          vcl.use <configname>
          vcl.discard <configname>
          vcl.list
          vcl.show <configname>
          param.show [-l] [<param>]
          param.set <param> <value>
          purge.url <regexp>
          purge <field> <operator> <arg> [&& <field> <oper> <arg>]...
          purge.list

          6、 有響應時間統計的報表嗎?
          比如對某個URL設置了緩存,那么我能否獲得該URL的響應時間統計。
          可以通過webbench測試URL的相應時間。
          root@zhouda webbench-1.5]# webbench -c 100 -t 60 http://10.112.5.219/info.php
          Webbench - Simple Web Benchmark 1.5
          Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
          Benchmarking: GET
          http://10.112.5.219/info.php
          100 clients, running 60 sec.
          Speed=695 pages/min, 612347 bytes/sec.
          Requests: 695 susceed, 0 failed.
          每秒鐘響應請求數:695 pages/min,每秒鐘傳輸數據量612347 bytes/sec.

          CRONTAB利做統計然后通過程序匯總成圖表

          7、 其它的
          如果你在研究過程中,發現有比較有用的功能,也整理一下告訴我。

          http://www.oschina.net/question/222919_57985
          http://www.oschina.net/question/17_6406
          http://www.discuz.net/thread-730015-1-1.html
          https://www.varnish-cache.org/docs
          https://www.varnish-cache.org/docs/3.0/tutorial/vcl.html

          另外,目前最新的測試版本在:http://42.121.12.4 

          posted on 2012-07-24 17:34 小秦 閱讀(930) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 文安县| 井研县| 黄平县| 金山区| 湾仔区| 色达县| 荥阳市| 绵竹市| 平谷区| 长春市| 永州市| 罗山县| 济源市| 福州市| 泰州市| 翼城县| 万州区| 富锦市| 梁河县| 白银市| 焦作市| 南昌市| 临猗县| 扶风县| 林甸县| 阿拉尔市| 临安市| 绥芬河市| 灵武市| 讷河市| 武胜县| 平江县| 闻喜县| 正阳县| 博客| 棋牌| 扎赉特旗| 九龙县| 玉溪市| 科技| 巴青县|