Operating System - Linux
1748227 Members
4123 Online
108759 Solutions
New Discussion юеВ

Re: recommended size cache_mem

 
SOLVED
Go to solution
Maaz
Valued Contributor

recommended size cache_mem


what would be the recommended size of cache_mem in squid.conf on a dedicated Gateway Server(squid2.6, and iptables), having 1 Gig DDR2 RAM ?

On a 20 users network, What would be the recommended size of hard drive cache size(cache_dir ufs /path/to/cache_dir SIZE 16 256) in squid.cong on a dedicated Gateway Server(squid2.6, and iptables), having 1 Gig DDR2 RAM ?

Regards
Maaz
12 REPLIES 12
Steven E. Protter
Exalted Contributor

Re: recommended size cache_mem

Shalom,

If the server id dedicated for one purpose, squid, you should max out the memory setting.

Here is how I'd calculate.

Start the server. Shut off squid.

free

Leave a few hundred meg, say 200 free for user processes and give the rest to squid. Don't push the system to the point where it pages processes in and out of swap.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor
Solution

Re: recommended size cache_mem

Based on http://wiki.squid-cache.org/SquidFaq/SquidMemory:

>>> As a rule of thumb on Squid uses approximately 10 MB of RAM per GB of the total of all cache_dirs (more on 64 bit servers such as Alpha), plus your cache_mem setting and about an additional 10-20MB. It is recommended to have at least twice this amount of physical RAM available on your Squid server.

So, if you have 1 GB RAM, squid should be configured to use about 500 MB (OS normally uses very small amount of memmory).

The cache_dir depends of your available space, and for each GB, 10 MB or RAM is used.

So, the formula should be:

((cache_dir/1024) * 10 MB ) + cache_mem MB + 20 MB <= 500 MB
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Maaz
Valued Contributor

Re: recommended size cache_mem

Thanks Dear SEP and Ivan Ferreira for help.

Ok, cache_mem is 300 now, and cache_dir is 2000(2 GB).

another issue, now when I run free -m I found memory usage 679 MB, and this machine is a dedicated Gateway machine and on the average with only 10 users simultaneously connected to the internet, but when I run top,

1, i dont find squid in the list.. why ?

95% of processes thats in the list(top output) consumes only the 0.0 %MEM, and only 2 or 3 process consumes 1.x or 3.x %MEM.

2, then why "free -m" shows MEM used as 679 MB, as per the output of top it should be very less ?

3, whats the proper way of checking which process is consuming/using how much MEM ?

Regards
Maaz
Maaz
Valued Contributor

Re: recommended size cache_mem

4, is there any command to check that how much mem is using by squid ? other than the formula(or manual calculaion) that Ivan provide ?

Regards
Maaz
Stuart Browne
Honored Contributor

Re: recommended size cache_mem

Ok, for 1, 3 & 4, 'ps -elf' is your friend. In particular:

ps -elf | grep squid

The 10th column is your memory usage in kilobytes.

In top, you can sort by memory usage by using 'M' (not m). This should also show you 'squid' near the top.

As for question 2, the memory 'used' in top is the same as the memory 'used' in free. These values are grabbed from '/proc/meminfo'. The tools just format it differently.
One long-haired git at your service...
Maaz
Valued Contributor

Re: recommended size cache_mem

thanks Dear Stuart Browne for help

I ran the following command

# ps -elf |grep squid
1 S root 2363 1 0 76 0 - 2987 wait 08:21 ? 00:00:00 /etc/init.d/squid start
4 S nobody 3259 2363 0 76 0 - 5594 - 08:21 ? 00:00:05 (squid) start

as per the output ( 2987 + 5594 = 8581 ) and then ( 8581 / 1000 = 8 MB ) its clear that squid is using only 8 MB isn't ?

then which process/software is using 679 MB of Memory on this dedicated Gateway server ?

top also doesnt show me any memory hungry process, so who is using 679-715 MB memory
Ivan Ferreira
Honored Contributor

Re: recommended size cache_mem

I think that the best way to check the memory information is using cachemgr.cgi as described in the link previously posted.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Maaz
Valued Contributor

Re: recommended size cache_mem

and why top doesnt show me the squid in its output ?

ok, one more thing bind is also running on this machine as a cache-only server, and bind is also not visible in top output .. why ?

Regards
Maaz
Ivan Ferreira
Honored Contributor

Re: recommended size cache_mem

How are you sorting the output of top? Can your share the output? Try using top -b
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?