Re: Is gethostbyaddr() slow?

From: Date: Thu, 04 Aug 2005 17:01:15 +0000
Subject: Re: Is gethostbyaddr() slow?
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-220020@lists.php.net to get a copy of this message
On 8/4/05, Kristen G. Thorson <kthorson@allegroconsultants.com> wrote: > 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? could you please mention the environment, i mean, the os, and the versions of php? is it binary install or a compile? > > > Thanks, > > kgt > > > > >

« previous php.general (#220020) next »