You are not logged in.

#1 2010-10-24 18:48:56

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

[Solved] A note and question about slow hostname lookups

I reinstalled Arch recently and the first thing I noticed was slow resolve times on hostname lookups.  This didn't happen on all webpages but did on about 50% of them.  This also happened on downloads from pacman %100 percent of the time.  I have done a good bit of research and most of the points led to nssswich.  One website said to try using this in nsswitch.conf:

hosts: files[NOTFOUND=continue UNAVAIL=continue] dns [NOTFOUND=continue UNAVAIL=continue TRYAGAIN=return] nis

With this it appears (after about 20 minutes of testing) that firefox lookups are again behaving normal again.  However, pacman is still having slow lookups (about 30 seconds for each package).  Does anyone know what could be the problem here.  I dont' know much about nsswitch or how it could be the problem.  Is there a way to help return pacman to regular lookup times?

Last edited by Gen2ly (2010-11-05 18:13:34)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#2 2010-10-24 22:41:14

dunz0r
Member
From: Sweden
Registered: 2009-03-30
Posts: 258
Website

Re: [Solved] A note and question about slow hostname lookups

Could you post your /etc/hosts?


RTFM or GTFO
hax0r.se

Offline

#3 2010-10-24 23:04:32

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] A note and question about slow hostname lookups

Yeah, no problem.

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>    <hostname.domain.org>                <hostname>
127.0.0.1        localhost.localdomain    localhost pavilion

# End of file

#####################################################################
# The Hosts File Project http://hostsfile.mine.nu
# Global Advert Servers Blocklist - Personal Edition
#####################################################################
# Release 2010-1-26
# Servers Verified as up and running 2010-1-26 (by dns exploration)
# Updated sorted and maintained by Andrew Short (sh0rtie)
# Contact: wduk10@hotmail.com
#####################################################################
# A big thank you to all contributers (too many to mention)
# who really have made this project a success, well done :)
# Licensed under the LGPL a copy of the license may be viewed at
# http://www.gnu.org/licenses/lgpl.txt
######################################################################
# WARNING:
# This file is *extremely comprehensive* and some sites might be
# included here that you wish to visit, if this is the case you can
# deactivate the block on that site by placing a # (octothorpe)symbol
# before its entry, this will deactivate blocking on that server
# so for example #127.0.0.1   foobar.com
# will enable you to visit foobar.com or you can just simply delete
# the line that contains the site you wish to visit.
# NB:
# For some computer software updates you may need to disable
# this file in order to perform the update, if you have problems
# rename this file from "hosts" to "hosts.txt" reboot then perform
# the update and then rename this file back to "hosts" to re-enable it
######################################################################
# You must keep the below lines
127.0.0.1    localhost
######################################################################

127.0.0.1    007arcadegames.com
127.0.0.1    00fun.com
127.0.0.1    00inkjets.com
127.0.0.1    00pro.com
127.0.0.1    00web.com
...

I use the hosts files to to block advertisements which is the stuff trailing on the end and continuing.  Think there might be a problemt here?


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#4 2010-10-24 23:48:26

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [Solved] A note and question about slow hostname lookups

Gen2ly,

perhaps are you using a bad DNS server ?

Thats a quick try, put for example

nameserver 8.8.8.8
nameserver 8.8.4.4

inside /etc/resolv.conf and try again.

Should that help, you will probably have to use /etc/resolv.conf.head because if you are using DHCP it will
overwrite etc/resolv.conf.

Above servers are the Google ones, but there are many other like the Opendns ones.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#5 2010-10-28 07:48:37

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [Solved] A note and question about slow hostname lookups

I have similiar problems, with websites as with pacman.

Between each package pacman receives there is a long duration where pacman tries do resolv it. The download of the package itself is still going fast.

I already tried the google nameservers as well as the opendns servers.

Offline

#6 2010-10-28 11:40:06

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [Solved] A note and question about slow hostname lookups

orschiro wrote:

I have similiar problems, with websites as with pacman.

Between each package pacman receives there is a long duration where pacman tries do resolv it. The download of the package itself is still going fast.

I already tried the google nameservers as well as the opendns servers.

Another possibility that has helped several people is to disable the ipv6 module:

https://wiki.archlinux.org/index.php/IP … the_Module

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#7 2010-10-28 11:52:30

kachelaqa
Member
Registered: 2010-09-26
Posts: 216

Re: [Solved] A note and question about slow hostname lookups

to speed up pacman, add your mirrors to /etc/hosts and use powerpill

Offline

#8 2010-10-30 11:16:28

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [Solved] A note and question about slow hostname lookups

Unfortunately the method with disabling IPv6 didn't help. And just speeding up pacman is only a workaround.

I want to know why the resolving is just that slow.

Regads

Offline

#9 2010-10-30 11:26:10

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [Solved] A note and question about slow hostname lookups

Try

dig archlinux.org | grep "Query time"

to check how slow your lookups really are, I get between 50 and 60 msec with both my ISP's and google's DNS on my home wlan.
Another workaround would be local DNS caching with dnsmasq.

Last edited by hokasch (2010-10-30 11:27:39)

Offline

#10 2010-10-30 13:28:00

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [Solved] A note and question about slow hostname lookups

Very strange. It looks like only the first lookup takes very long and after that for some time the page is looked up quite fast. There seems to be a kind of timeout. Is that normal?

[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 198 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 33 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 25 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 24 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 21 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 28 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 23 msec
[root@thinkpad robert]# dig archlinux.org | grep "Query time"
;; Query time: 22 msec

Offline

#11 2010-10-30 15:04:37

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [Solved] A note and question about slow hostname lookups

orschiro wrote:

Very strange. It looks like only the first lookup takes very long and after that for some time the page is looked up quite fast. There seems to be a kind of timeout. Is that normal?

You can make the DNS timeout smaller, put a line in resolv.conf:

options timeout:1

You can also disable ipv6 in firefox. Type about:config and in the Filter line type "ipv".

There change

network.dns.disableIPv6;false

to "true".

Apart from that, I support the hokasch opinion about dnsmasq.

This doesn't clarify why DNS has these delays, but dnsmasq in itself has many advantages. I do use it.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#12 2010-10-30 17:37:02

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [Solved] A note and question about slow hostname lookups

Holy crap thank you for this hint Mektub with DNS timeout. That worked instantly, for both, pacman and website query. I will have to put this in the wiki, this is really great. smile

Kind regards

Offline

#13 2010-10-30 17:46:17

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [Solved] A note and question about slow hostname lookups

Very strange. It looks like only the first lookup takes very long and after that for some time the page is looked up quite fast. There seems to be a kind of timeout. Is that normal?

Holy crap thank you for this hint Mektub with DNS timeout. That worked instantly, for both, pacman and website query.

If I'm not mistaken, this means the first DNS server is too slow, while the second one is ok - and with lowering the timeout tolerance, it skips to the second one quicker. What is in your /etc/resolv.conf? Try removing the first nameserver...

Last edited by hokasch (2010-10-30 17:52:44)

Offline

#14 2010-11-05 18:13:10

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Solved] A note and question about slow hostname lookups

Mektub wrote:
orschiro wrote:

Very strange. It looks like only the first lookup takes very long and after that for some time the page is looked up quite fast. There seems to be a kind of timeout. Is that normal?

You can make the DNS timeout smaller, put a line in resolv.conf:

options timeout:1

Ahh good tip.  With new nameservers from comcast (thanks Mektub) and this did the trick.  Appreciate the help.

Last edited by Gen2ly (2010-11-05 18:14:30)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#15 2010-11-06 02:31:47

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] A note and question about slow hostname lookups

I get:

$ dig archlinux.org | grep "Query time"
;; Query time: 260 msec

$ dig archlinux.org | grep "Query time"
;; Query time: 0 msec

$ dig archlinux.org | grep "Query time"
;; Query time: 0 msec

This is with running bind locally with -4 in commandline.

Offline

Board footer

Powered by FluxBB