On Mon, 11 Apr 2011 07:52:41 -0400 (EDT), rpereyra@xxxxxxxxxxx wrote:
Hi
How I can limit the ram memory use in my squid/tproxy box ?
I have a fast server with 16Gb ram. The average bandwidth is about
60-70
Mb/s.
The bridge works well but when the cache and memory becomes full its
goes
slow and becomes unusable.
The cache is 10G size.
I see that a few hours to be working and have used the 16 GB of RAM
starts to run slow.
Any help ?. I have configured some memory optimization options but
looks
don't help for me.
Thanks in advance
roberto
This is my config:
-------------------------------------
cache_mem 10 MB
memory_pools off
cache_swap_low 94
cache_swap_high 95
<snip>
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged)
machines
acl net-g1 src 200.117.xxx.xxx/24
acl net-g2 src 200.xxx.xxx.xxx/24
acl net-g3 src 190.xxx.xxx.xxx/24
<snip>
http_access allow net-g1
http_access allow net-g2
http_access allow net-g3
Being "allow" you can grab some extra speed by combining these all
under one ACL name. "localnet" being the standard one for local network
ranges.
<snip>
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 10000 64 256
<snip>
Given those cache sizes, your Squid box should be using around 110 MB
of RAM for index plus a little. Even assuming a worst-case of a minutes
traffic accumulated in transit buffers comes nowhere close to filling 16
GB up.
Some questions that may help narrow down where the slow is coming from:
What version of Squid is this?
What are your avg object size?
How many concurrent client connections?
"slow" and "normal" response speeds?
Do you notice any change in the Squid->Internet request types during
the slowdown? (ie a move to extra MISS/HIT/IMS/REFRESH)
And like Michael said the disk IO stats are important to look at. When
the cache_dir gets to 94% full it will start spending CPU and disk
cycles on erasing objects. If it reaches 95% a larger portion of cycles
get used until it drops down below 94% again.
Amos