Page 1 of 1

How to increase cache speed in squid ?

Posted: Sat Jan 08, 2011 11:39 am
by gardenair
I need guidance related to squid cache.I am using Red Hat Linux as a squid proxy server. My server have 200 GB Hard Disk with 3 GB ram.
The clients mostly visit google,msn ,yahoo mail ,gmail,hotmail.
To increase the cache speed I does't know which tag should I use so my clients may access the web pages very fast. If I am not correct please guide me.

In /etc/squid/squid.conf file cache_mem 16 MB as default size.Can we change it upto 500MB

Another related thing is cache_dir ufs /cache 200 16 256.The default size of cache dir is 200 so can I increase it upto 500 ?

thanks in advance.

Posted: Tue Jan 18, 2011 2:34 pm
by lambda
set cache_mem to no more than 1/3rd of your RAM. you can set it to 1GB.
the 200 in your cache_dir line means just 200 mbytes. set it to something like 150000 (around 150 gbytes).

the more you can cache in memory, the faster it'll work. you should also change the "ufs" in the cache_dir line to aufs.

also, use a recent server distribution, like ubuntu 10.04 LTS server.

Posted: Wed Jan 19, 2011 10:31 am
by Kamran.Ahmed
Dear Lambda

I want to ask why you suggest ubuntu server over Red hat can you elaborate solid reasons???? , i think RHEL is very much solid option

Posted: Wed Jan 19, 2011 5:49 pm
by lambda
1. upgrading ubuntu whenever a new release comes out is way easier than upgrading rhel. for example, see the network upgrade for ubuntu servers section under the 8.04 LTS to 10.04 LTS heading.

2. rhel ships once every few years. with ubuntu, you have the choice of using LTS (long term release) -- one release every 2-3 years, or upgrading every six months. that's for both desktop and server distributions.

3. rhel ships with some really old apps. for example, rhel 5 (released in march 2007) ships with python 2.4 (released in november 2004). rhel 6 is better in that respect, but even then, it has 2.6 whereas the stable release right now is 2.7 (3.x is still experimental). by the time rhel 7 comes out, rhel 6's packages will seem terribly old. a lot of people had to compile their own versions of php because rhel 5's version is ancient.

4. ubuntu has access to more packages -- over 20,000 in 9.04, for example.

and lastly,

5. if you use rhel, it's likely that you didn't pay for the subscription, and won't get updates. use ubuntu server, where security/other updates are free for five years. without updates, it's likely that someone will be able to break into your server, especially if you run a php website, etc.

Posted: Thu Jan 20, 2011 12:51 pm
by Kamran.Ahmed
Valuable information ! :(

Thanks my dear Lambda Bhai

Re: How to increase cache speed in squid ?

Posted: Wed Nov 28, 2012 2:14 pm
by kamranayyub
Hats off! Very informative post and I also need this information.

Re: How to increase cache speed in squid ?

Posted: Wed Dec 12, 2012 10:34 am
by aquiline
Okay! it's not directly related to changing Squid Cache Size & Speed... :D but may be help in overall performance of Squid :wink:

Anyway here's my own eXperience with Squid Speed Issues, just sharing for fun... Yes feel free to disagree :roll:

1. FreeBSD (64bit is better, 32bit is good) is best of all, I have tried CENTOS, Fedora (RHEL xBased), Debian and Ubuntu and very little of once SUN Solaris (when Oracle takeover the SUN, I don't know where is Solaris...Community died ...ah!)

2. Yes try on some decent (64bit) machine, plenty of RAM and Adventure it with ZFS...! oh ya just have a fun...Wait for a moment.

3. Recent, Updated Version of Squid is also important, yes new features count on performance...try Squid 3x or Compile latest from squid-cache website.

3. Try to configure on same or other near by machine "pDNSd" {cd /usr/ports/dns/pdnsd && Make install clean}. I observe considerable difference in speed of web browsing when you use your local Cache-DNS Server... "pdnsd is a proxy dns server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or
down dns servers (for example in dial-in networking). pdnsd can be used with applications that do dns lookups.... more details pDNSd
little bit more details of pDNSd
Also try to dns server: (add this in "pdnsd.conf" and use as your DNS) OR try to run test for fast, near DNS server.

4. So increasing size of squid cache is very important, but also consider other factors, like OS (the big horse) file system, local cache DNS Server, and in squid.conf give "dns_nameservers" in case you are using DNS Cache Server on same machine.

Have a Fun :idea: :arrow: