# squid performance



## d0ne (Feb 13, 2010)

```
proxy# squidclient -p 3128 mgr:info
HTTP/1.0 200 OK
Server: squid/2.7.STABLE7
Date: Sat, 13 Feb 2010 18:11:56 GMT
Content-Type: text/plain
Expires: Sat, 13 Feb 2010 18:11:56 GMT
X-Cache: MISS from proxy.d0ne.net
X-Cache-Lookup: MISS from proxy.d0ne.net:3128
Via: 1.0 proxy.d0ne.net:3128 (squid/2.7.STABLE7)
Connection: close

Squid Object Cache: Version 2.7.STABLE7
Start Time:     Sat, 13 Feb 2010 16:33:14 GMT
Current Time:   Sat, 13 Feb 2010 18:11:56 GMT
Connection information for squid:
        Number of clients accessing cache:      7
        Number of HTTP requests received:       12174
        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:   123.4
        Average ICP messages per minute since start:    0.0
        Select loop called: 988333 times, 5.991 ms avg
Cache information for squid:
        Request Hit Ratios:     5min: 25.6%, 60min: 24.8%
        Byte Hit Ratios:        5min: 0.3%, 60min: 1.4%
        Request Memory Hit Ratios:      5min: 1.1%, 60min: 2.8%
        Request Disk Hit Ratios:        5min: 4.4%, 60min: 32.8%
        Storage Swap size:      491486 KB
        Storage Mem size:       13768 KB
        Mean Object Size:       9.22 KB
        Requests given to unlinkd:      0
Median Service Times (seconds)  5 min    60 min:
        HTTP Requests (All):   0.52331  1.11539
        Cache Misses:          0.94847  1.46131
        Cache Hits:            0.01309  0.03066
        Near Hits:             0.58309  0.80651
        Not-Modified Replies:  0.01469  0.01309
        DNS Lookups:           0.15593  0.00094
        ICP Queries:           0.00000  0.00000
Resource usage for squid:
        UP Time:        5921.522 seconds
        CPU Time:       28.768 seconds
        CPU Usage:      0.49%
        CPU Usage, 5 minute avg:        0.49%
        CPU Usage, 60 minute avg:       0.52%
        Process Data Segment Size via sbrk(): 0 KB
        Maximum Resident Size: 44572 KB
        Page faults with physical i/o: 0
Memory accounted for:
        Total accounted:        20782 KB
        memPoolAlloc calls: 2201360
        memPoolFree calls: 2049656
File descriptor usage for squid:
        Maximum number of file descriptors:   11095
        Largest file desc currently in use:    166
        Number of file desc currently in use:   62
        Files queued for open:                   0
        Available number of file descriptors: 11033
        Reserved number of file descriptors:   100
        Store Disk files open:                   0
        IO loop method:                     kqueue
Internal Data Structures:
         53346 StoreEntries
          1913 StoreEntries with MemObjects
          1907 Hot Object Cache Items
         53312 on-disk objects
```

Please help me check this performnace

Thanks


----------



## DutchDaemon (Feb 13, 2010)

Define 'performance'. Hit ratio will only go up when the disk cache is nicely filled and people's repetitive surfing behaviour starts showing up. Same goes for byte ratio, though that one will always be lower. You should expect to see close to 50% hit ratio and myabe 20-30% byte ratio over time. Increasing RAM given to caching will speed things up (IMS hits), and allowing bigger objects will improve byte ratio (not by very much though).


----------



## d0ne (Feb 13, 2010)

```
cache_mem 1 GB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 131072 KB
maximum_object_size_in_memory 64 KB
ipcache_size 8192
ipcache_low 90
ipcache_high 95
fqdncache_size 8192
cache_replacement_policy heap GDSF
memory_replacement_policy heap GDSF
```


```
cache_dir diskd /usr/cache1 12600 29 256 Q1=64 Q2=72
cache_dir diskd /usr/cache2 12600 29 256 Q1=64 Q2=72
cache_dir diskd /usr/cache3 12600 29 256 Q1=64 Q2=72
cache_dir diskd /usr/cache4 12600 29 256 Q1=64 Q2=72
```

is it right or wrong ?
Thanks


----------



## DutchDaemon (Feb 14, 2010)

There is no simple 'right or wrong', that depends on your goals. 

Some comments:

I have no idea why you're using 29 top-level directories for your caches (it's usually 16/256, not 29/256), but whatever makes you happy, I guess.

As to Q1/Q2, see the comments in the squid.conf.default file. There's a trade-off between response time and hit rate there.

Your maximum_object_size looks quite excessive. What are the chances of two people using the same 128 MB file in your user population? Using 8 or 16 MB should be enough to get at least some hit rates on bigger files. If you cache huge objects, your disks will fill up quickly, which will negatively affect hit/byte ratios.


----------



## d0ne (Feb 14, 2010)

Thanks


----------



## d0ne (Feb 14, 2010)

Update

```
proxy# squidclient -p 3128 mgr:info
HTTP/1.0 200 OK
Server: squid/2.7.STABLE7
Date: Sun, 14 Feb 2010 10:38:58 GMT
Content-Type: text/plain
Expires: Sun, 14 Feb 2010 10:38:58 GMT
X-Cache: MISS from proxy.d0ne.net
X-Cache-Lookup: MISS from proxy.d0ne.net:3128
Via: 1.0 proxy.d0ne.net:3128 (squid/2.7.STABLE7)
Connection: close

Squid Object Cache: Version 2.7.STABLE7
Start Time:     Sun, 14 Feb 2010 10:01:48 GMT
Current Time:   Sun, 14 Feb 2010 10:38:58 GMT
Connection information for squid:
        Number of clients accessing cache:      7
        Number of HTTP requests received:       3363
        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:   90.5
        Average ICP messages per minute since start:    0.0
        Select loop called: 216581 times, 10.295 ms avg
Cache information for squid:
        Request Hit Ratios:     5min: 47.4%, 60min: 40.5%
        Byte Hit Ratios:        5min: 19.2%, 60min: 10.4%
        Request Memory Hit Ratios:      5min: 2.4%, 60min: 3.3%
        Request Disk Hit Ratios:        5min: 7.9%, 60min: 4.2%
        Storage Swap size:      116266 KB
        Storage Mem size:       6360 KB
        Mean Object Size:       10.72 KB
        Requests given to unlinkd:      0
Median Service Times (seconds)  5 min    60 min:
        HTTP Requests (All):   0.33943  0.42149
        Cache Misses:          0.76407  0.68577
        Cache Hits:            0.02451  0.01235
        Near Hits:             0.15888  0.15888
        Not-Modified Replies:  0.00000  0.00307
        DNS Lookups:           0.00094  0.05078
        ICP Queries:           0.00000  0.00000
Resource usage for squid:
        UP Time:        2229.801 seconds
        CPU Time:       7.026 seconds
        CPU Usage:      0.32%
        CPU Usage, 5 minute avg:        0.19%
        CPU Usage, 60 minute avg:       0.32%
        Process Data Segment Size via sbrk(): 0 KB
        Maximum Resident Size: 22840 KB
        Page faults with physical i/o: 0
Memory accounted for:
        Total accounted:         8581 KB
        memPoolAlloc calls: 573442
        memPoolFree calls: 531422
File descriptor usage for squid:
        Maximum number of file descriptors:   11095
        Largest file desc currently in use:     87
        Number of file desc currently in use:   84
        Files queued for open:                   0
        Available number of file descriptors: 11011
        Reserved number of file descriptors:   100
        Store Disk files open:                   0
        IO loop method:                     kqueue
Internal Data Structures:
         10874 StoreEntries
           742 StoreEntries with MemObjects
           738 Hot Object Cache Items
         10841 on-disk objects
```

Thanks


----------

