Centos – slow response from squid proxy – optimization

centosPROXYsquid

We use squid 3.0 on Centos5.3 and have currently 20 users (Internet Explorer) using this proxy. The problem
is that the access through proxy is slower. Even a simple webpage like google.com(.au) takes 5sec longer than
a direct connection without proxy. Looks like there is approximately 2-5 second delay. Disabling cache for
google.com(.au) didn't help. Explicitely defining dns_nameservers makes no difference.

Server parameters : Dual-Core AMD Opteron(tm) Processor 2220, 6GB memory, 60gb SCSI hdd

cache_mem 256 MB
cache_dir ufs /usr/local/squid/var/cache 30000 16 256
maximum_object_size_in_memory 256 KB
minimum_object_size 0 KB (0 – 200 KB – not a real difference, the delay is still there)
maximum_object_size 32 MB

How would you change these specifications in squid.conf based on the server specifications.
What can cause the delay ? Also for a bigger webpage like yahoo.com.au is there a way to receive a part of the page
from cache and then the rest (images last). At the moment there is nothing for 15 sec and then a whole webpage appears.

Best Answer

My first hunch would be to sniff the traffic using tcpdump and load it into wireshark to see where the delay is happening.

tcpdump -i any -s 0 -w /tmp/squid.pcap

(If you're doing it over ssh, add "not port ssh" to the end.)

Once you load this into wireshark you should be able to see where the delay appears to be. I'd recommend doing this during a quiet time so there isn't too much traffic obscuring your view. If you can be the only person accessing the proxy at the time, even better.

Likely delays are:

  • Browser contacting proxy
  • Proxy contacting webserver
  • Proxy DNS requests
  • Proxy returning response to browser
Related Topic