squid命中率查看
最近公司准备自建CDN,准备在原来的一台squid的基础上,再增加两台。由于长时间不动squid,对squid的配置和查看都生疏了。所以先拿自己的域名开刀,配置下squid,并查看下命中率。
[root@localhost squid]# squidclient -p 80 mgr:info HTTP/1.0 200 OK Server: squid/3.1.10 Mime-Version: 1.0 Date: Mon, 26 Nov 2012 14:41:51 GMT Content-Type: text/plain Expires: Mon, 26 Nov 2012 14:41:51 GMT Last-Modified: Mon, 26 Nov 2012 14:41:51 GMT X-Cache: MISS from cache.361way.com X-Cache-Lookup: MISS from cache.361way.com:80 Via: 1.0 cache.361way.com (squid/3.1.10) Connection: close Squid Object Cache: Version 3.1.10 Start Time: Mon, 26 Nov 2012 13:18:50 GMT Current Time: Mon, 26 Nov 2012 14:41:51 GMT Connection information for squid: Number of clients accessing cache: 34 Number of HTTP requests received: 774 Number of ICP messages received: 0 Number of ICP messages sent: 0 Number of queued ICP replies: 0 Number of HTCP messages received: 0 Number of HTCP messages sent: 0 Request failure ratio: 0.00 Average HTTP requests per minute since start: 9.3 #每分钟http request的数量 Average ICP messages per minute since start: 0.0 Select loop called: 637052 times, 7.818 ms avg Cache information for squid: Hits as % of all requests: 5min: 77.1%, 60min: 58.8% #Cache Request命中率 Hits as % of bytes sent: 5min: 28.4%, 60min: 20.4% #Cache Byte命中率 Memory hits as % of hit requests: 5min: 43.9%, 60min: 32.0% Disk hits as % of hit requests: 5min: 0.0%, 60min: 0.2% Storage Swap size: 328 KB #存放cache的硬盘使用大小 Storage Swap capacity: 0.0% used, 100.0% free Storage Mem size: 436 KB #存放cache的内存使用大小 Storage Mem capacity: 0.1% used, 99.9% free Mean Object Size: 6.56 KB Requests given to unlinkd: 2 Median Service Times (seconds) 5 min 60 min: HTTP Requests (All): 0.06286 0.06286 Cache Misses: 0.32154 0.20843 Cache Hits: 0.00000 0.00000 Near Hits: 0.06286 0.06286 Not-Modified Replies: 0.00000 0.00000 DNS Lookups: 0.00000 0.00000 ICP Queries: 0.00000 0.00000 Resource usage for squid: UP Time: 4980.301 seconds CPU Time: 1.379 seconds CPU Usage: 0.03% CPU Usage, 5 minute avg: 0.09% CPU Usage, 60 minute avg: 0.03% Process Data Segment Size via sbrk(): 7508 KB Maximum Resident Size: 59728 KB Page faults with physical i/o: 0 Memory usage for squid via mallinfo(): Total space in arena: 7640 KB Ordinary blocks: 7587 KB 61 blks Small blocks: 0 KB 0 blks Holding blocks: 1228 KB 5 blks Free Small blocks: 0 KB Free Ordinary blocks: 52 KB Total in use: 8815 KB 99% Total free: 52 KB 1% Total size: 8868 KB Memory accounted for: #内存使用情况 Total accounted: 1253 KB 14% memPool accounted: 1253 KB 14% memPool unaccounted: 7614 KB 86% memPoolAlloc calls: 167272 memPoolFree calls: 169189 File descriptor usage for squid: Maximum number of file descriptors: 1024 #系统最大file descriptor数 Largest file desc currently in use: 39 #目前使用file descriptor最大值 Number of file desc currently in use: 33 #目前正在使用的file descriptor数 Files queued for open: 0 Available number of file descriptors: 991 Reserved number of file descriptors: 100 Store Disk files open: 0 Internal Data Structures: 77 StoreEntries #Cache中存放的 object 的数量 77 StoreEntries with MemObjects #内存中 object 数量 76 Hot Object Cache Items #热点object 的数量 50 on-disk objects # 硬盘上的object的数量
上面的-p后面根的是端口,根据自己具体的情况而定。如果是3128端口,就把上面的80换成3128就行了。另外一些常用的squidclient查询语句如下:
squidclient -p 80 mgr:info #取得squid运行状态信息: squidclient -p 80 mgr:mem #取得squid内存使用情况: squidclient -p 80 mgr:objects #取得squid已经缓存的列表,使用时要小心,可能会造成squid崩溃: squidclient -p 80 mgr:diskd #取得squid的磁盘使用情况: squidclient -p 80 -m PURGE http://www.361way.com #强制更新某个url,即清理某连接的squid
本站的发展离不开您的资助,金额随意,欢迎来赏!
You can donate through PayPal.My paypal id: itybku@139.comPaypal page: https://www.paypal.me/361way
You can donate through PayPal.My paypal id: itybku@139.comPaypal page: https://www.paypal.me/361way
近期评论