Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I download any document from internet using wget. It shows maximum amount of time consumed in getaddrinfo().

I know getaddrinfo() used for DNS lookup.

Tell me any method, so that this time is reduced to negligible, just like making any table for host name and their corresponding IP address, so that wget can get coresponding IP address very quickly.

Question

Tell me also, how can I implement this. Thanks in advance. Looking for your kind response.

Command, I use

ltrace -c -o log_ltrace_wget_new1.txt wget http://www.ada.gov/briefs/kovacsbr.doc

Output

% time     seconds  usecs/call     calls      function
------ ----------- ----------- --------- --------------------
 67.11    7.070607      336695        21    select
 19.67    2.071956        5739       361    strlen
 10.59    1.115199     1115199         1    getaddrinfo
  0.32    0.033705         298       113    fgets
  0.27    0.028261         197       143    malloc
  .....
  .....
  .....
share|improve this question
3  
Possibly it's trying to do a AAAA query to resolve IPv6 addresses and that timesout or something along those lines. Try a network capture to get a better idea of what's causing the delay. –  Stéphane Chazelas Mar 12 '13 at 7:56

1 Answer 1

Build a local dns cache using nscd (Name service cache daemon) or dnsmasq (A real dns server)

Otherwise alternate your default dns server from /etc/resolv.conf

share|improve this answer
    
I added IP address of www.ada.gov, i.e., 149.101.146.61 in resolv.conf. [In vi editor, it shows this line in red background] .But it shows the same time consumed in getaddrinfo. –  devnull Mar 12 '13 at 7:00
    
@jhamb then there's no way to improve it unless you give up glibc –  warl0ck Mar 12 '13 at 7:05
    
But there is no change shown in time consumed in getaddrinfo(). If I resolve DNS locally, then it should show less time than previous. Why it does not show less time ? –  devnull Mar 12 '13 at 7:07
    
Note that at least on Debian and Ubuntu, host caching is disabled in the default configuration, so you need to reenable it. –  Stéphane Chazelas Mar 12 '13 at 7:48
2  
@jhamb jftr if you added www.ada.gov to resolv.conf nothing will change as it is the wrong configuration file. Either try to use another dns server like 8.8.8 or add www.ada.gov to /etc/hosts or follow stephanes advice –  Ulrich Dangel Mar 12 '13 at 8:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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