squid性能分析
获得squid执行中的信息状况
1、当不知道有什么信息可以查询时
./squidclient -h 127.0.0.1 -p 80 mgr:
2、General Runtime Information,察看一般的状态
./squidclient -h 127.0.0.1 -p 80 mgr:info
[root@bbs bin]# ./squidclient -h 127.0.0.1 -p 80 mgr:info
HTTP/1.0 200 OK
Date: Wed, 14 Sep 2011 01:14:00 GMT
Content-Type: text/plain
Expires: Wed, 14 Sep 2011 01:14:00 GMT
Last-Modified: Wed, 14 Sep 2011 01:14:00 GMT
Connection: close
Squid Object Cache: Version 2.6.STABLE23
Start Time: Mon, 15 Aug 2011 07:29:43 GMT
Current Time: Wed, 14 Sep 2011 01:14:00 GMT
Connection information for squid:
Number of clients accessing cache: 7035 //使用proxy的客户端的数量
Number of HTTP requests received: 102208621 //客户端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: 2386.7 //每分钟http request的数量
Average ICP messages per minute since start: 0.0 //每分钟处理的icp数量
Select loop called: 1078256179 times, 2.383 ms avg
Cache information for squid:
Request Hit Ratios: 5min: 72.9%, 60min: 71.3% //Cache Request命中率
Byte Hit Ratios: 5min: 86.2%, 60min: 85.7% //Cache Byte命中率
Request Memory Hit Ratios: 5min: 16.9%, 60min: 18.3%
Request Disk Hit Ratios: 5min: 36.6%, 60min: 41.2%
Storage Swap size: 36863864 KB //存放cache的磁盘使用量
Storage Mem size: 602600 KB //存放cache的内存使用量
Mean Object Size: 72.02 KB
Requests given to unlinkd: 822436
Median Service Times (seconds) 5 min 60 min: //平均回应时间
HTTP Requests (All): 0.00865 0.01955
Cache Misses: 0.13498 0.14252
Cache Hits: 0.00463 0.00678
Near Hits: 0.10281 0.11465
Not-Modified Replies: 0.00091 0.00179
DNS Lookups: 0.00000 0.00000
ICP Queries: 0.00000 0.00000
Resource usage for squid:
UP Time: 2569457.334 seconds
CPU Time: 36073.998 seconds
CPU Usage: 1.40% //自squid启动起计算,CPU使用率
CPU Usage, 5 minute avg: 2.15% //最近5分钟CPU使用率
CPU Usage, 60 minute avg: 1.73% //最近60分钟CPU使用率
Process Data Segment Size via sbrk(): 813452 KB
Maximum Resident Size: 0 KB
Page faults with physical i/o: 3
Memory usage for squid via mallinfo():
Total space in arena: 813452 KB
Ordinary blocks: 811350 KB 2289 blks
Small blocks: 0 KB 0 blks
Holding blocks: 2976 KB 3 blks
Free Small blocks: 0 KB
Free Ordinary blocks: 2101 KB
Total in use: 814326 KB 100%
Total free: 2101 KB 0%
Total size: 816428 KB
Memory accounted for: //内存使用状态
Total accounted: 756036 KB
memPoolAlloc calls: 3191693493
memPoolFree calls: 3187306562
File descriptor usage for squid:
Maximum number of file descriptors: 1024 //系统最大file descriptor数
Largest file desc currently in use: 838 //目前使用file descriptor最大值
Number of file desc currently in use: 738 //目前正在使用的file descriptor数
Files queued for open: 0
Available number of file descriptors: 286 //剩余有效的使用量
Reserved number of file descriptors: 100 //保留的使用量
Store Disk files open: 22
IO loop method: epoll
Internal Data Structures:
539827 StoreEntries //Cache中存放的缓存档案数量
137907 StoreEntries with MemObjects //内存中的缓存档案数量
137873 Hot Object Cache Items
511853 on-disk objects //磁盘中存放的快取档案数量
3、查看5分钟的状态
./squidclient -h 127.0.0.1 -p 80 mgr:5min
[root@bbs bin]# ./squidclient -h 127.0.0.1 -p 80 mgr:5min
HTTP/1.0 200 OK
Date: Wed, 14 Sep 2011 06:25:00 GMT
Content-Type: text/plain
Expires: Wed, 14 Sep 2011 06:25:00 GMT
Last-Modified: Wed, 14 Sep 2011 06:25:00 GMT
Connection: close
sample_start_time = 1315981166.699347 (Wed, 14 Sep 2011 06:19:26 GMT)
sample_end_time = 1315981466.707914 (Wed, 14 Sep 2011 06:24:26 GMT)
client_http.requests = 85.857548/sec //客户端每秒的http要求数
client_http.hits = 64.574823/sec //客户端每秒的http命中次数
client_http.errors = 0.000000/sec
client_http.kbytes_in = 77.871110/sec //客户端每秒送出的资料量
client_http.kbytes_out = 1756.599837/sec //每秒送出至客户端的资料量
client_http.all_median_svc_time = 0.024508 seconds //反应时间
client_http.miss_median_svc_time = 0.150482 seconds
client_http.nm_median_svc_time = 0.000911 seconds
client_http.nh_median_svc_time = 0.092188 seconds
client_http.hit_median_svc_time = 0.003785 seconds
server.all.requests = 29.049170/sec //squid帮客户端抓取的请求数
server.all.errors = 0.000000/sec
server.all.kbytes_in = 316.374299/sec //squid对外抓取的资料量
server.all.kbytes_out = 29.719151/sec //squid对外送出需求的资料量
server.http.requests = 29.049170/sec
server.http.errors = 0.000000/sec
server.http.kbytes_in = 316.374299/sec
server.http.kbytes_out = 29.719151/sec
server.ftp.requests = 0.000000/sec
server.ftp.errors = 0.000000/sec
server.ftp.kbytes_in = 0.000000/sec
server.ftp.kbytes_out = 0.000000/sec
server.other.requests = 0.000000/sec
server.other.errors = 0.000000/sec
server.other.kbytes_in = 0.000000/sec
server.other.kbytes_out = 0.000000/sec
icp.pkts_sent = 0.000000/sec
icp.pkts_recv = 0.000000/sec
icp.queries_sent = 0.000000/sec
icp.replies_sent = 0.000000/sec
icp.queries_recv = 0.000000/sec
icp.replies_recv = 0.000000/sec
icp.replies_queued = 0.000000/sec
icp.query_timeouts = 0.000000/sec
icp.kbytes_sent = 0.000000/sec
icp.kbytes_recv = 0.000000/sec
icp.q_kbytes_sent = 0.000000/sec
icp.r_kbytes_sent = 0.000000/sec
icp.q_kbytes_recv = 0.000000/sec
icp.r_kbytes_recv = 0.000000/sec
icp.query_median_svc_time = 0.000000 seconds
icp.reply_median_svc_time = 0.000000 seconds
dns.median_svc_time = 0.000000 seconds //DNS的反应时间
unlink.requests = 1.136634/sec
page_faults = 0.000000/sec
select_loops = 893.234492/sec
select_fds = 993.841619/sec
average_select_fd_period = 0.001006/fd
median_select_fds = 0.000000
swap.outs = 0.979972/sec
swap.ins = 89.290783/sec
swap.files_cleaned = 0.000000/sec
aborted_requests = 3.059913/sec //客户端中断连线请求的次数
syscalls.polls = 893.234492/sec
syscalls.disk.opens = 45.585365/sec
syscalls.disk.closes = 45.625364/sec
syscalls.disk.reads = 384.002368/sec
syscalls.disk.writes = 16.976182/sec
syscalls.disk.seeks = 3.619897/sec
syscalls.disk.unlinks = 1.136634/sec
syscalls.sock.accepts = 110.343516/sec
syscalls.sock.sockets = 28.942507/sec
syscalls.sock.connects = 28.942507/sec
syscalls.sock.binds = 28.942507/sec
syscalls.sock.closes = 86.660859/sec
syscalls.sock.reads = 361.643006/sec
syscalls.sock.writes = 594.876346/sec
syscalls.sock.recvfroms = 0.000000/sec
syscalls.sock.sendtos = 0.000000/sec
cpu_time = 9.611539 seconds //squid占用CPU的时间
wall_time = 300.008567 seconds //取样的时间总长
cpu_usage = 3.203755% //平均CPU使用率
参考文章:http://hctan.blog.163.com/blog/static/1403320076735133985/