歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

squid命中率分析參數注釋

默認squid配置文件裡面已經加上
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
http_access allow all
#cachemgr_passwd pass all
http_access allow Manager all
 

3.0直接看這裡
基本的使用方法
*取得squid運行狀態信息: squidclient -p 80 mgr:info //注意這裡80要是你對應的端口號

根目錄下 #/usr/local/squid/bin/squidclient -p 3128 mgr:info
*取得squid內存使用情況: squidclient -p 80 mgr:mem
*取得squid已經緩存的列表: squidclient -p 80 mgr:objects. use it carefully,it may crash
*取得squid的磁盤使用情況: squidclient -p 80 mgr:diskd
*強制更新某個url:squidclient -p 80 -m PURGE http://www.baidu.com/index.php

*更多的請查看:squidclient -h 或者 squidclient -p 80 mgr:

* 如何得知 squid 執行中的狀態?

最簡單的方式便是透過浏覽器來觀察。squid 本身提供一只 cgi 程式,檔名為cachemgr.cgi,squid 安裝完後將它復制到 Apache 下的 cgi-bin 這個目錄下即可使用。

要察看Cache Manager提供的資訊時,請在浏覽器的位址列中鍵入

http://伺服器的名稱或IP位址/cgi-bin/cachemgr.cgi

當然,我更加喜歡使用下面的方法

/usr/local/squid/bin/squidclient -h localhost -p 80 mgr:info

下面是一些基本內容

Squid Object Cache: Version 2.6 //Squid的版本

HTTP/1.0 200 OK
Date: Tue, 11 Mar 2008 16:08:14 GMT
Content-Type: text/plain
Expires: Tue, 11 Mar 2008 16:08:14 GMT
Last-Modified: Tue, 11 Mar 2008 16:08:14 GMT
Connection: close

Squid Object Cache: Version 2.6.STABLE6
Start Time: Tue, 11 Mar 2008 10:21:47 GMT
Current Time: Tue, 11 Mar 2008 16:08:14 GMT
Connection information for squid:
Number of clients accessing cache: 2023 使用proxy的電腦數量
Number of HTTP requests received: 81787 客戶端http要求數量
Number of ICP messages received: 0 接受到的icp query數量
Number of ICP messages sent: 0 發出icp query數量
Number of queued ICP replies: 0
Request failure ratio: 0.00
Average HTTP requests per minute since start: 236.1 每分鐘http request的數量
Average ICP messages per minute since start: 0.0
Select loop called: 24789642 times, 0.839 ms avg
Cache information for squid:
Request Hit Ratios: 5min: 99.6%, 60min: 98.7% Cache Request命中率
Byte Hit Ratios: 5min: 100.0%, 60min: 100.0% Cache Byte命中率
Request Memory Hit Ratios: 5min: 1.6%, 60min: 1.2%
Request Disk Hit Ratios: 5min: 82.0%, 60min: 90.5%
Storage Swap size: 7723212 KB 存放cache的磁碟使用量
Storage Mem size: 7992 KB 存放cache的記憶體使用量
Mean Object Size: 264.01 KB
Requests given to unlinkd: 279
Median Service Times (seconds) 5 min 60 min:
HTTP Requests (All): 2.94900 3.46762
Cache Misses: 0.03427 0.03427
Cache Hits: 5.06039 4.79440
Near Hits: 0.30459 0.35832
Not-Modified Replies: 0.00179 0.00179
DNS Lookups: 0.00000 0.00000
ICP Queries: 0.00000 0.00000
Resource usage for squid:
UP Time: 20787.011 seconds
CPU Time: 128.799 seconds
CPU Usage: 0.62%
CPU Usage, 5 minute avg: 0.44%
CPU Usage, 60 minute avg: 0.51%
Process Data Segment Size via sbrk(): 34292 KB
Maximum Resident Size: 0 KB
Page faults with physical i/o: 0
Memory usage for squid via mallinfo():
Total space in arena: 34424 KB
ordinary blocks: 27031 KB 8599 blks
Small blocks: 0 KB 0 blks
Holding blocks: 6152 KB 2 blks
Free Small blocks: 0 KB
Free ordinary blocks: 7392 KB
Total in use: 33183 KB 82%
Total free: 7392 KB 18%
Total size: 40576 KB
Memory accounted for: 記憶體使用狀態
Total accounted: 21777 KB
memPoolAlloc calls: 15446992
memPoolFree calls: 15337015
File descriptor usage for squid:
Maximum number of file descriptors: 16384 系統最大file descriptor數
Largest file desc currently in use: 1165 目前使用file descriptor最大值
Number of file desc currently in use: 571 目前正在使用的file descriptor數
Files queued for open: 0
Available number of file descriptors: 15813
Reserved number of file descriptors: 100
Store Disk files open: 266
IO loop method: epoll
Internal Data Structures:
29315 StoreEntries Cache中存放的快取檔案數量
190 StoreEntries with MemObjects 記憶體斗的快取檔案數量
176 Hot Object Cache Items 磁碟機中存放的快取檔案數量
29253 on-disk objects

Squid的幾個命中率代表的含義
某方面的 5分鐘平均值 一小時平均值
Request Hit Ratios: 5min: 80.1%, 60min: 80.3%
Byte Hit Ratios: 5min: 66.6%, 60min: 70.0%
Request Memory Hit Ratios: 5min: 30.3%, 60min: 32.6%
Request Disk Hit Ratios: 5min: 8.7%, 60min: 8.8%


Request Hit Ratios:表示第二次或者以後的請求時,發現它在緩存裡面且有效,不然就從原始服務器讀取拉
Byte Hit Ratios:顧名思義,字節數嘛
Request Memory Hit Ratios:這個是緩存在內存裡面的東西
Request Disk Hit Ratios:這個是從硬盤讀取的
 

Copyright © Linux教程網 All Rights Reserved