How to increase cache speed in squid ?

General discussion about Linux, Linux distribution, using Linux etc.
Post Reply
gardenair
Havaldaar
Posts: 106
Joined: Tue Dec 28, 2004 10:07 pm

How to increase cache speed in squid ?

Post by gardenair »

Hi,
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.
garden
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post 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.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Kamran.Ahmed
Lance Naik
Posts: 45
Joined: Wed Dec 16, 2009 5:57 pm
Location: Karachi

Post 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
Kamran Ahmed Khan
kamran.cisco@gmail.com
Registered Linux User # 526139
www.allaboutlinux.org
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post 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.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Kamran.Ahmed
Lance Naik
Posts: 45
Joined: Wed Dec 16, 2009 5:57 pm
Location: Karachi

Post by Kamran.Ahmed »

Valuable information ! :(

Thanks my dear Lambda Bhai
Kamran Ahmed Khan
kamran.cisco@gmail.com
Registered Linux User # 526139
www.allaboutlinux.org
kamranayyub
Cadet
Posts: 7
Joined: Mon Oct 15, 2012 12:22 pm
Contact:

Re: How to increase cache speed in squid ?

Post by kamranayyub »

Hats off! Very informative post and I also need this information.
aquiline
Company Havaldaar Major
Posts: 178
Joined: Sat Nov 20, 2004 5:56 pm
Location: Attock-#-Junction

Re: How to increase cache speed in squid ?

Post 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: 4.2.2.2 (add this in "pdnsd.conf" and use 127.0.0.1 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 127.0.0.1" in case you are using DNS Cache Server on same machine.

Have a Fun :idea: :arrow:
Sh@Ring is Le@Rning
Post Reply