Random ...
 
December 2017
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Tags ...
Links



Linux++:::: Monitoring your squid
Posted at 20.Mar,2007 12:08  Comments 0 / Trackbacks 0 / Like this post!
Technorati tag(s):

I have a few squid installations acting as an httpd accelerator. After a while, I'd like to know how these squids perform.

How can we achieve this?

There's cache manager (cachemgr.cgi) that requires we install and enable http + cgi support.

There's also squidclient.

With squidclient, we can get much statistics to ponder and throw away (:)).

Here's a few that might interest some of us:

  squidclient -h 192.168.1.x -p 80 mgr:info

  HTTP/1.0 200 OK
  Server: squid/2.6.STABLE6
  Date: Tue, 20 Mar 2007 04:49:52 GMT
  Content-Type: text/plain
  Expires: Tue, 20 Mar 2007 04:49:52 GMT
  Last-Modified: Tue, 20 Mar 2007 04:49:52 GMT
  X-Cache: MISS from xx.xx.com.my
  Via: 1.0 xx.xx.com.my:80 (squid/2.6.STABLE6)
  Connection: close

  Squid Object Cache: Version 2.6.STABLE6
  Start Time:     Wed, 07 Mar 2007 06:20:49 GMT
  Current Time:   Tue, 20 Mar 2007 04:49:52 GMT
  Connection information for squid:
        Number of clients accessing cache:      13401
        Number of HTTP requests received:       26416850
        Number of ICP messages received:        12173866
        Number of ICP messages sent:    12174958
        Number of queued ICP replies:   0
       Request failure ratio:   0.00
        Average HTTP requests per minute since start:   1418.0
        Average ICP messages per minute since start:    1307.0
        Select loop called: -2144956104 times, -0.521 ms avg
  Cache information for squid:
        Request Hit Ratios:     5min: 55.6%, 60min: 58.2%
        Byte Hit Ratios:        5min: 42.8%, 60min: 47.0%
        Request Memory Hit Ratios:      5min: 3.1%, 60min: 2.9%
        Request Disk Hit Ratios:        5min: 44.8%, 60min: 43.8%
        Storage Swap size:      1843044 KB
        Storage Mem size:       797464 KB
        Mean Object Size:       14.21 KB
        Requests given to unlinkd:      0
  Median Service Times (seconds)  5 min    60 min:
        HTTP Requests (All):   0.00678  0.00767
        Cache Misses:          0.01745  0.03622
        Cache Hits:            0.00562  0.00562
        Near Hits:             0.09736  0.12106
        Not-Modified Replies:  0.00286  0.00286
        DNS Lookups:           0.00000  0.00000
        ICP Queries:           0.00000  0.00000
  Resource usage for squid:
        UP Time:        1117743.313 seconds
        CPU Time:       36369.113 seconds
        CPU Usage:      3.25%
        CPU Usage, 5 minute avg:        12.86%
        CPU Usage, 60 minute avg:       12.61%
        Process Data Segment Size via sbrk(): 1918888 KB
        Maximum Resident Size: 0 KB
        Page faults with physical i/o: 156
  Memory usage for squid via mallinfo():
        Total space in arena:  1918888 KB
        Ordinary blocks:       1604965 KB 192658 blks
        Small blocks:               0 KB      0 blks
        Holding blocks:          2596 KB      4 blks
        Free Small blocks:          0 KB
        Free Ordinary blocks:  313922 KB
        Total in use:          1607561 KB 84%
        Total free:            313922 KB 16%
        Total size:            1921484 KB
 Memory accounted for:
        Total accounted:       1473329 KB
        memPoolAlloc calls: 1616505531
        memPoolFree calls: 1607627595
 File descriptor usage for squid:
        Maximum number of file descriptors:   8192
        Largest file desc currently in use:   7625
        Number of file desc currently in use: 3968
        Files queued for open:                   0
        Available number of file descriptors: 4224
        Reserved number of file descriptors:   100
        Store Disk files open:                 738
        IO loop method:                     epoll
 Internal Data Structures:
        239672 StoreEntries
        130246 StoreEntries with MemObjects
           102 Hot Object Cache Items
        129736 on-disk objects

Of interests are Connection Information, Cache Information, and Resource Usage Information. We can gather a lot of info from these stats; for example, this squid install has about 50% hit rate, which is quite ok, but could be better since we're acting as an http accelerator.

Here's another way to see the squid's cache hitrate:

  squidclient -h host -p 80 mgr:refresh

  RefreshCheck calls per protocol

  Protocol        #Calls  %Calls
      HTTP      15342550         60.95
       ICP           0    0.00
  On Store      9831131  39.05

  RefreshCheck histograms for various protocols

  HTTP histogram:
  Count   %Total  Category
    10    0.00  Fresh: request max-stale wildcard
     0    0.00  Fresh: request max-stale value
  5925586  38.62  Fresh: expires time not reached
  9080473  59.18  Fresh: refresh_pattern last-mod factor percentage
     0    0.00  Fresh: refresh_pattern min value
     0    0.00  Fresh: refresh_pattern override expires
     0    0.00  Fresh: refresh_pattern override lastmod
  18429    0.12  Stale: response has must-revalidate
     0    0.00  Stale: changed reload into IMS
     0    0.00  Stale: request has no-cache directive
  74569    0.49  Stale: age exceeds request max-age value
  49797    0.32  Stale: expires time reached
  90922    0.59  Stale: refresh_pattern max age rule
  101761    0.66  Stale: refresh_pattern last-mod factor percentage
  1003    0.01  Stale: by default
  15342550        100.00  TOTAL

  ICP histogram:
  Count   %Total  Category
     0   -1.00  Fresh: request max-stale wildcard
     0   -1.00  Fresh: request max-stale value
     0   -1.00  Fresh: expires time not reached
     0   -1.00  Fresh: refresh_pattern last-mod factor percentage
     0   -1.00  Fresh: refresh_pattern min value
     0   -1.00  Fresh: refresh_pattern override expires
     0   -1.00  Fresh: refresh_pattern override lastmod
     0   -1.00  Stale: response has must-revalidate
     0   -1.00  Stale: changed reload into IMS
     0   -1.00  Stale: request has no-cache directive
     0   -1.00  Stale: age exceeds request max-age value
     0   -1.00  Stale: expires time reached
     0   -1.00  Stale: refresh_pattern max age rule
     0   -1.00  Stale: refresh_pattern last-mod factor percentage
     0   -1.00  Stale: by default
     0   -1.00  TOTAL

  On Store histogram:
  Count   %Total  Category
     0    0.00  Fresh: request max-stale wildcard
     0    0.00  Fresh: request max-stale value
  5007960  50.94  Fresh: expires time not reached
  2611671  26.57  Fresh: refresh_pattern last-mod factor percentage
     0    0.00  Fresh: refresh_pattern min value
     0    0.00  Fresh: refresh_pattern override expires
     0    0.00  Fresh: refresh_pattern override lastmod
     0    0.00  Stale: response has must-revalidate
     0    0.00  Stale: changed reload into IMS
     0    0.00  Stale: request has no-cache directive
     0    0.00  Stale: age exceeds request max-age value
  106620    1.08  Stale: expires time reached
  170364    1.73  Stale: refresh_pattern max age rule
  150242    1.53  Stale: refresh_pattern last-mod factor percentage
  1784274  18.15  Stale: by default
  9831131 100.00  TOTAL

Some other information that's of interests are:

  squidclient -h host -p 80 mgr:counters
  squidclient -h host -p 80 mgr:utilization
  squidclient -h host -p 80 mgr:5min
  squidclient -h host -p 80 mgr:60min
  squidclient -h host -p 80 mgr:mem

And make sure we set the access control right, otherwise, everybody can query our squid.

Give it a try!


Bookmark and Share

Is this entry helpful? Comments/Donate/Click some google ads.  
Trackback is http://myzope.kedai.com.my/blogs/kedai/124/tbping 

Comments
Post a comment