squid 初始网页加载缓慢

squid 初始网页加载缓慢

我相信我已经成功地在我的 Debian 7 服务器上安装了 squid,但是每当我尝试使用它时,从一个域中第一次加载的速度都非常慢,而从同一域的后续页面加载速度却很快。我怎样才能加快初始加载/查找速度?

我使用的是 debian 7 和 squid 3.1.20。

我的 squid3 -v 是;

配置选项:'--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=.' '--禁用维护者模式' '--禁用依赖性跟踪' '--禁用静默规则' '--datadir=/usr/share/squid3' '--sysconfdir=/etc/squid3' '--mandir=/usr/share/man' '--with-cppunit-basedir=/usr' '--启用内联' '--启用async-io=8' '--启用storeio=ufs,aufs,diskd' '--启用removal-policies=lru,heap' '--启用延迟池' '--启用缓存摘要' '--启用下划线' '--启用icap-客户端' '--启用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

我的 squid.conf 是

acl mynetwork src acl safe_ports 端口 80 acl connet 方法 connet http_access 允许 mynetwork http_port 3128 forwarded_for off http_access 全部拒绝

这是来自我的 debian 服务器的 wget 的一个示例,它几乎立即完成。

--2014-01-02 12:42:23-- http://bbc.co.uk/ 正在解析 bbc.co.uk (bbc.co.uk)... 212.58.253.67, 212.58.251.195 正在连接到 bbc.co.uk (bbc.co.uk)|212.58.253.67|:80... 已连接。HTTP 请求已发送,正在等待响应... 301 永久移动位置:http://www.bbc.co.uk/[关注] --2014-01-02 12:42:23-- http://www.bbc.co.uk/ 解析 www.bbc.co.uk (www.bbc.co.uk)... 212.58.244.67, 212.58.244.66 连接到 www.bbc.co.uk (www.bbc.co.uk)|212.58.244.67|:80... 已连接。HTTP 请求已发送,正在等待响应... 200 OK 长度:111538 (109K) [text/html] 保存至:index.html' 100%[=============================================================================>] 111,538 --.-K/s in 0.06s 2014-01-02 12:42:23 (1.79 MB/s) -index.html'已保存 [111538/111538]

我还检查了 ps aux,squid 似乎没有对服务器造成任何重大负载。

我还可以做些什么?

答案1

我也遇到了 squid(Cygwin 上的 v3.3.3)运行缓慢的问题,我通过将下面的指令放入我的squid配置文件

dns_v4_first on

答案2

就是这样,谢谢。/etc/resolv.conf 中发生的事情是 localhost 和我的 isps dns。显然,它使用 localhost 来查找 dns 查询,当它超时时,它故障转移到我的 isps dns,后者立即找到主机并加载页面。为了解决这个问题,我在 squid.conf 中添加了 dns_nameservers 并重新启动了 squid

相关内容