2

i believe i have managed to sucsessfully install squid on my debian 7 server, however whenever i attempt to use it loading of the first from a domain is incredibly slow, subsequent page loads from the same domain are loading fast. how can i speed up the initial loading/lookup?

im using debian 7 and squid 3.1.20.

my squid3 -v is;

configure options: '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/squid3' '--srcdir=.' '--disable-maintainer-mode' '--disable-dependency-tracking' '--disable-silent-rules' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--with-cppunit-basedir=/usr' '--enable-inline' '--enable-async-io=8' '--enable-storeio=ufs,aufs,diskd' '--enable-removal-policies=lru,heap' '--enable-delay-pools' '--enable-cache-digests' '--enable-underscores' '--enable-icap-client' '--enable-follow-x-forwarded-for' '--enable-auth=basic,digest,ntlm,negotiate' '--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SASL,SMB,YP,DB,POP3,getpwnam,squid_radius_auth,multi-domain-NTLM' '--enable-ntlm-auth-helpers=smb_lm,' '--enable-digest-auth-helpers=ldap,password' '--enable-negotiate-auth-helpers=squid_kerb_auth' '--enable-external-acl-helpers=ip_user,ldap_group,session,unix_group,wbinfo_group' '--enable-arp-acl' '--enable-esi' '--enable-zph-qos' '--enable-wccpv2' '--disable-translation' '--with-logdir=/var/log/squid3' '--with-pidfile=/var/run/squid3.pid' '--with-filedescriptors=65536' '--with-large-files' '--with-default-user=proxy' '--enable-linux-netfilter' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall' 'LDFLAGS=-fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security' --with-squid=/tmp/buildd/squid3-3.1.20

my squid.conf is

acl mynetwork src acl safe_ports port 80 acl connet method connet http_access allow mynetwork http_port 3128 forwarded_for off http_access deny all

here is a example of a wget from my debian server, which completed almost instantly.

--2014-01-02 12:42:23-- http://bbc.co.uk/ Resolving bbc.co.uk (bbc.co.uk)... 212.58.253.67, 212.58.251.195 Connecting to bbc.co.uk (bbc.co.uk)|212.58.253.67|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.bbc.co.uk/ [following] --2014-01-02 12:42:23-- http://www.bbc.co.uk/ Resolving www.bbc.co.uk (www.bbc.co.uk)... 212.58.244.67, 212.58.244.66 Connecting to www.bbc.co.uk (www.bbc.co.uk)|212.58.244.67|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 111538 (109K) [text/html] Saving to: index.html' 100%[=============================================================================>] 111,538 --.-K/s in 0.06s 2014-01-02 12:42:23 (1.79 MB/s) -index.html' saved [111538/111538]

i have also checked ps aux and squid doesn't appear to be putting any significant load on the server.

what else can i do?

  • Have you tried to run wget on debian server using your squid proxy and not directly? – GeekMagus Jan 3 '14 at 13:02
  • took a little bit of time, it was stuck on 'awaiting response...' for a while(7 or 8 seconds) then eventually moved on and downloaded the page in 0.03s. had to change the config a little to allow for localhost though. – glend Jan 3 '14 at 13:49
  • Possibly a DNS related issue? What DNS server are you using? Do you have "dns_nameservers" option inside your squid.conf? – GeekMagus Jan 3 '14 at 14:16
  • i dont, what should i use? – glend Jan 3 '14 at 14:18
  • Try to add one, point it to 8.8.8.8, 8.8.4.4 (Google public DNS). This may be an issue, I'm not sure though. – GeekMagus Jan 3 '14 at 18:55
4

I also encountered slowness with squid (v3.3.3 from Cygwin), and solved the problem by putting the following directive in my squid.conf:

dns_v4_first on

0

that was it, thank you. heres what was happening inside /etc/resolv.conf was localhost and my isps dns. obviously it was using localhost to find do dns queries and when it timed out it failed over to my isps dns which found the host immediately and loaded the page. to fix it i added dns_nameservers into squid.conf and restarted squid

  • I'm glad you solved your issue. Please accept your own answer so your question not displayed in active ones. – GeekMagus Jan 5 '14 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.