阅读317 返回首页    go 中电云集


squid本身的客户端squidclient介绍

基本的使用方法

*取得squid运行状态信息: squidclient -p 80 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 https://www.php-oa.com/static.php

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

* 如何得知 squid 执行中的状态?

最简单的方式便是透过浏览器来观察。squid 本身提供一只 cgi 程式,档名为cachemgr.cgi,squid 安装完后将它复制到 Apache 下的 cgi-bin 这个目录下即可使用。

要察看Cache Manager提供的资讯时,请在浏览器的位址列中键入

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

当然,我更加喜欢使用下面的方法

squidclient -t 1 -h localhost -p 80 mgr:inf 这样也行

下面是一些基本内容

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

Proxy 回应的速度很慢时,可能是那里出问题?如何判定问题发生在那里?

网路回应慢有可能是目的网站的问题,也有可能是带宽不足的问题带宽需求是永远根不上使用者的脚步,故在网路出现变慢的问题时,请先以 ping 或 traceroute 指令测试网路的连线状态,如果封包回应很慢或封包遗失率很高,应该是属网路本身的问题,如果测试的结果良好,再继续看是否是 Proxy 出了问题。当然ping也不一定能说明问题

最后更新:2017-01-04 22:34:34

  上一篇:go HTTP状态码(HTTP Status Code)
  下一篇:go MySQL Innodb性能优化