Squid loads some website very slow
I installed a couple of weeks ago squid on my network and first it was making websites load very slow with the default configuration but after a few changes in the squid.conf (copied from a different server in my company that works ok) now is working fine most of the time but from time to time, some websites still load very slow.
Is not exactly that the website load slow, what happens is that it gets like freeze for 3 or 4 seconds an then starts loading the website. It was doing this already before the config changes.
I have exactly the same squid configuration on a different site (better hardware but more users) and is working perfectly.
The machine is a small Barebone with Debian 6 only used for shorewall and squid. The problem might have to do with the server only having 512MB of RAM and the HDD being a SD card but as said before, is only used for firewall and Squid.
This old server will be removed in the near future but users and managers are always complaining about it
Here is the squid config
604a605,608
> acl salesforce dstdomain .salesforce.com
> always_direct allow salesforce
> cache deny salesforce
>
609,611c613,621
< 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 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.20.0/24 # RFC1918 possible internal network
>
> #Bad Sites file
> acl bad_url dstdomain "/etc/squid/bad-sites.squid"
>
>
>
676c686,687
< #http_access allow localnet
---
> http_access deny bad_url
> http_access allow localnet
677a689,691
> http_access deny bad_url
>
>
690a705
>
1747c1762,1763
< # maximum_object_size_in_memory 8 KB
---
> # maximum_object_size_in_memory 8KB
> maximum_object_size_in_memory 5000 KB
1756c1772
< # memory_replacement_policy lru
---
> memory_replacement_policy lru
1798c1814
< # cache_replacement_policy lru
---
> cache_replacement_policy lru
1945c1961
< # cache_dir ufs /var/spool/squid 100 16 256
---
> cache_dir ufs /var/spool/squid 25000 16 256
1988,1989c2004,2005
< # maximum_object_size 20480 KB
<
---
> maximum_object_size 25600 KB
>
2005,2006c2021,2022
< # cache_swap_low 90
< # cache_swap_high 95
---
> cache_swap_low 80
> cache_swap_high 95
2631c2647,2659
< # none
---
>
> #Disble caching for the domain intranet.mysite.com
> acl nocache-1 dstdomain intranet.mysite.com
> cache deny nocache-1
>
> #Disbale cache for site mysite.com
> acl nocache-0 dstdomain www.mysite.com
> cache deny nocache-0
>
> #Disble cache for site salesforce.com
> acl nocache-0 dstdomain .salesforce.com
> acl nocache-0 dstdomain .force.com
>
3100c3128
< # none
---
> header_access Accept-Encoding deny all
3364c3392
< # cache_effective_user proxy
---
> cache_effective_user squid
3376c3404
< # none
---
> cache_effective_group squid
3392c3420
< # none
---
> #
>
4948a4980,4983
> #Cache Purge
> acl PURGE method PURGE
> http_access allow PURGE localhost
> http_access deny PURGE
Any suggestion??
I finally found the problem and as with most users, is related to DNS and IPv6. I had to disable IPv6 in my OS as well as remove the IPv6 entries from the /etc/hosts file. The software squidclient helped to find the problem.