lkml.org 
[lkml]   [1999]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectSlow name-server lookups
Hello..

In trying to locate the reason for slow nameserver lookups using
V2.2.2, I find:

This is what nslookup does. It use UDP which is connectionless, saving
the time for a 'connection' to be established and its attendent overhead.

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
sendto(3, "\232\331\1\0\0\1\0\0\0\0\0\0\003"...,
45, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("204.178.40.210")}, 16) = 45
SYS_142(0x4, 0xbfffeb54, 0, 0, 0xbfffe918) = 1
recvfrom(3, "\232\331\205\200\0\1\0\1\0\1\0\1"...,
1024, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("204.178.40.210")}, [16]) = 143
close(3) = 0

This is what glibc-2.0.6 gethostbyname() does.

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
connect(3, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("204.178.40.210")}, 16) = 0
send(3, "K\32\1\0\0\1\0\0\0\0\0\0\ngfils-"..., 41, 0) = 41
SYS_142(0x4, 0xbfffe3f0, 0, 0, 0xbfffe3dc) = 1
recvfrom(3, "K\32\205\200\0\1\0\1\0\1\0\1\ngf"...,
1024, 0, {sin_family=AF_INET, sin_port=htons(53),
sin_addr=inet_addr("204.178.40.210")}, [16]) = 110
close(3) = 0

It takes time to establish a connection. Looking at the glibc-2.0.6 code
I see that the 'connection' is a trick to get a 'connection-refused'
message from the server if a nameserver isn't running on the respective
host. So glibc-2.0.6 compromises the speed of nameserver lookups as a
debugging convenience for those who failed to enter the correct
name-server IP address in their configuration files???

In the case of the current problem, I observe that it is the connection
that takes a long time, not the UDP datagram messages which run through
at millisecond intervals just fine.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.2 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:1.038 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site