Reply to Re: [PHP] Re: Is gethostbyaddr() slow?

Your name:

Reply:


Posted by "Kristen G. Thorson" on 08/04/05 19:32

kalinga wrote:

> if you are quering a external host, the bad network conditions may
>
>cause delay in results.
>
>if your server is connected to a heavily loaded hub/ cheap switch, or
>the target hosts DNS servers are poorly configured/ slow in responce
>it adds further delay to your result.
>
>try dig/ nslookup on your server for the target hostname/address, you
>may experience the same delay as with the php function.
>
>
>

Thanks for the reply. The problem I had - and that I was trying to
briefly describe - is not quite explained by slow DNS lookup, at least
not so far. I have one script, run on the same machine:

takes less than 1 second on CLI:

# php gethostbyname.php
Content-type: text/html
X-Powered-By: PHP/4.3.2

gethostbyname(www.imakenews.com) took 0.0010 s and resolved to
208.254.39.65<br>
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to
63.87.252.162<br>
gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to
216.239.113.159<br>
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to
63.87.252.162<br>


Running CLI again, host names are apparently cached, because then they
all return in .0005 seconds.

takes 20 seconds under Apache 2.0.46:

gethostbyname(www.imakenews.com) took 5.0071 s and resolved to
208.254.39.65
gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to
63.87.252.162
gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to
216.239.113.159
gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to
63.87.252.162


This will happen consistently, with less than 1/100 s variation in time
for each lookup.


Any DNS lookup tools are perfectly fast when run from the command line.
Also, other machines in the same subnet, using the same DNS servers,
using 99% same apache config files (I diff'ed 'em) run just as fast
under same apache/php version as they do command line. It's hard to
imagine what external DNS problem could exist that would affect only one
of our servers, and on that one, only apache/php and nothing command
line. Something else is going on, but my initial tries of
downgrading/upgrading both php and apache haven't made a different yet.
Perhaps you have another suggestion?


Thanks,

kgt

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация