squid命中率查看
最近公司准备自建CDN,准备在原来的一台squid的基础上,再增加两台。由于长时间不动squid,对squid的配置和查看都生疏了。所以先拿自己的域名开刀,配置下squid,并查看下命中率。
1[root@localhost squid]# squidclient -p 80 mgr:info
2HTTP/1.0 200 OK
3Server: squid/3.1.10
4Mime-Version: 1.0
5Date: Mon, 26 Nov 2012 14:41:51 GMT
6Content-Type: text/plain
7Expires: Mon, 26 Nov 2012 14:41:51 GMT
8Last-Modified: Mon, 26 Nov 2012 14:41:51 GMT
9X-Cache: MISS from cache.361way.com
10X-Cache-Lookup: MISS from cache.361way.com:80
11Via: 1.0 cache.361way.com (squid/3.1.10)
12Connection: close
13Squid Object Cache: Version 3.1.10
14Start Time: Mon, 26 Nov 2012 13:18:50 GMT
15Current Time: Mon, 26 Nov 2012 14:41:51 GMT
16Connection information for squid:
17 Number of clients accessing cache: 34
18 Number of HTTP requests received: 774
19 Number of ICP messages received: 0
20 Number of ICP messages sent: 0
21 Number of queued ICP replies: 0
22 Number of HTCP messages received: 0
23 Number of HTCP messages sent: 0
24 Request failure ratio: 0.00
25 Average HTTP requests per minute since start: 9.3 #每分钟http request的数量
26 Average ICP messages per minute since start: 0.0
27 Select loop called: 637052 times, 7.818 ms avg
28Cache information for squid:
29 Hits as % of all requests: 5min: 77.1%, 60min: 58.8% #Cache Request命中率
30 Hits as % of bytes sent: 5min: 28.4%, 60min: 20.4% #Cache Byte命中率
31 Memory hits as % of hit requests: 5min: 43.9%, 60min: 32.0%
32 Disk hits as % of hit requests: 5min: 0.0%, 60min: 0.2%
33 Storage Swap size: 328 KB #存放cache的硬盘使用大小
34 Storage Swap capacity: 0.0% used, 100.0% free
35 Storage Mem size: 436 KB #存放cache的内存使用大小
36 Storage Mem capacity: 0.1% used, 99.9% free
37 Mean Object Size: 6.56 KB
38 Requests given to unlinkd: 2
39Median Service Times (seconds) 5 min 60 min:
40 HTTP Requests (All): 0.06286 0.06286
41 Cache Misses: 0.32154 0.20843
42 Cache Hits: 0.00000 0.00000
43 Near Hits: 0.06286 0.06286
44 Not-Modified Replies: 0.00000 0.00000
45 DNS Lookups: 0.00000 0.00000
46 ICP Queries: 0.00000 0.00000
47Resource usage for squid:
48 UP Time: 4980.301 seconds
49 CPU Time: 1.379 seconds
50 CPU Usage: 0.03%
51 CPU Usage, 5 minute avg: 0.09%
52 CPU Usage, 60 minute avg: 0.03%
53 Process Data Segment Size via sbrk(): 7508 KB
54 Maximum Resident Size: 59728 KB
55 Page faults with physical i/o: 0
56Memory usage for squid via mallinfo():
57 Total space in arena: 7640 KB
58 Ordinary blocks: 7587 KB 61 blks
59 Small blocks: 0 KB 0 blks
60 Holding blocks: 1228 KB 5 blks
61 Free Small blocks: 0 KB
62 Free Ordinary blocks: 52 KB
63 Total in use: 8815 KB 99%
64 Total free: 52 KB 1%
65 Total size: 8868 KB
66Memory accounted for: #内存使用情况
67 Total accounted: 1253 KB 14%
68 memPool accounted: 1253 KB 14%
69 memPool unaccounted: 7614 KB 86%
70 memPoolAlloc calls: 167272
71 memPoolFree calls: 169189
72File descriptor usage for squid:
73 Maximum number of file descriptors: 1024 #系统最大file descriptor数
74 Largest file desc currently in use: 39 #目前使用file descriptor最大值
75 Number of file desc currently in use: 33 #目前正在使用的file descriptor数
76 Files queued for open: 0
77 Available number of file descriptors: 991
78 Reserved number of file descriptors: 100
79 Store Disk files open: 0
80Internal Data Structures:
81 77 StoreEntries #Cache中存放的 object 的数量
82 77 StoreEntries with MemObjects #内存中 object 数量
83 76 Hot Object Cache Items #热点object 的数量
84 50 on-disk objects # 硬盘上的object的数量
上面的-p后面根的是端口,根据自己具体的情况而定。如果是3128端口,就把上面的80换成3128就行了。另外一些常用的squidclient查询语句如下:
1squidclient -p 80 mgr:info #取得squid运行状态信息:
2squidclient -p 80 mgr:mem #取得squid内存使用情况:
3squidclient -p 80 mgr:objects #取得squid已经缓存的列表,使用时要小心,可能会造成squid崩溃:
4squidclient -p 80 mgr:diskd #取得squid的磁盘使用情况:
5squidclient -p 80 -m PURGE https://blog.361way.com #强制更新某个url,即清理某连接的squid
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/squid-percentage/1951.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.