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

2005-08-05 Thread Kristen G. Thorson



kalinga wrote:


On 8/4/05, Kristen G. Thorson [EMAIL PROTECTED] 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.65br
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
63.87.252.162br
gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 
216.239.113.159br
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
63.87.252.162br



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?

 



All binaries - RH-packaged rpms.

Working version (takes  1 second for each gethostbyname() call under 
CLI and under apache):


# rpm -qa | grep php
php-odbc-4.3.2-23.ent
php-imap-4.3.2-23.ent
php-pgsql-4.3.2-23.ent
php-4.3.2-23.ent
php-ldap-4.3.2-23.ent
php-mysql-4.3.2-23.ent
# rpm -qa | grep httpd
httpd-2.0.46-46.ent
redhat-config-httpd-1.1.0-4.30.2
httpd-devel-2.0.46-46.ent
# uname -r -o -i -s
Linux 2.4.21-4.ELsmp i386 GNU/Linux


Not working (takes 5 seconds for each gethostbyname() call under apache, 
but  1 second under CLI):


# rpm -qa | grep php
php-imap-4.3.2-23.ent
php-4.3.2-23.ent
php-odbc-4.3.2-23.ent
php-mysql-4.3.2-23.ent
php-ldap-4.3.2-23.ent
php-pgsql-4.3.2-23.ent
# rpm -qa | grep httpd
httpd-2.0.46-46.ent
redhat-config-httpd-1.1.0-4.30.2
httpd-devel-2.0.46-46.ent
# uname -r -o -i -s
Linux 2.4.21-4.ELsmp i386 GNU/Linux


The function returns correctly, but it takes about 5 seconds every 
time.  After I run the script the first time on the not working 
machine, it looks like the names are cached for the CLI, as they tend to 
take only .0005 seconds to resolve.


Thanks for the help.


kgt





[PHP] Re: Is gethostbyaddr() slow?

2005-08-04 Thread kalinga
On 8/4/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
 I can say from personal experience that gethostbyaddr() and 
 gethostbyname() can seem almost randomly slow, depending on machine, OS, 
 software, who knows.  I'm not smart enough to figure out the reason why 
 it can vary so much on machines with nearly the same configuration, but 
 I can tell you that it works perfectly fast most of the time.  Then 
 there's that other 5% where something makes it slow as molasses.
 
 I have two machines that are so similar it's not funny, but 
 gethostbyname() takes 1/10 s on one, and 5 s on the other.  I have yet 
 to figure out what's the difference between them that causing this.
 
 
 kgt
 
 
 
 Dotan Cohen wrote:
 
 Hi all, I just discovered the gethostbyaddr() function. By reading the
 user contributed notes, I get the impression that either this function
 may cause performance problems, or a user-contributed function based
 upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
 Thanks!
 
 Dotan Cohen
 http://lyricslist.com/lyrics/artist_albums/56/bangles.php
 The Bangles Song Lyrics
 
   
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Is gethostbyaddr() slow?

2005-08-04 Thread kalinga
On 8/4/05, kalinga [EMAIL PROTECTED] wrote:
 On 8/4/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
  I can say from personal experience that gethostbyaddr() and 
  gethostbyname() can seem almost randomly slow, depending on machine, OS, 
  software, who knows.  I'm not smart enough to figure out the reason why 
  it can vary so much on machines with nearly the same configuration, but 
  I can tell you that it works perfectly fast most of the time.  Then 
  there's that other 5% where something makes it slow as molasses.
  
  I have two machines that are so similar it's not funny, but 
  gethostbyname() takes 1/10 s on one, and 5 s on the other.  I have yet 
  to figure out what's the difference between them that causing this.

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.


~viraj.

  
  
  kgt
  
  
  
  Dotan Cohen wrote:
  
  Hi all, I just discovered the gethostbyaddr() function. By reading the
  user contributed notes, I get the impression that either this function
  may cause performance problems, or a user-contributed function based
  upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
  Thanks!
  
  Dotan Cohen
  http://lyricslist.com/lyrics/artist_albums/56/bangles.php
  The Bangles Song Lyrics
  

  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Is gethostbyaddr() slow?

2005-08-04 Thread kalinga
i missed another keypoint..

if you are running unix/linux server, you need to have a properly
setup resolv.conf

or if you experience a slowness while you quering your own domains,
check whether you DNS servers are providing authoritative answers to
your domains.


~viraj.

On 8/4/05, kalinga [EMAIL PROTECTED] wrote:
 On 8/4/05, kalinga [EMAIL PROTECTED] wrote:
  On 8/4/05, Kristen G. Thorson [EMAIL PROTECTED] wrote:
   I can say from personal experience that gethostbyaddr() and 
   gethostbyname() can seem almost randomly slow, depending on machine, OS,
 
   software, who knows.  I'm not smart enough to figure out the reason why
 
   it can vary so much on machines with nearly the same configuration, but
 
   I can tell you that it works perfectly fast most of the time.  Then 
   there's that other 5% where something makes it slow as molasses.
   
   I have two machines that are so similar it's not funny, but 
   gethostbyname() takes 1/10 s on one, and 5 s on the other.  I have yet 
   to figure out what's the difference between them that causing this.
 
 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.
 
 
 ~viraj.
 
   
   
   kgt
   
   
   
   Dotan Cohen wrote:
   
   Hi all, I just discovered the gethostbyaddr() function. By reading the
   user contributed notes, I get the impression that either this function
   may cause performance problems, or a user-contributed function based
   upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
   Thanks!
   
   Dotan Cohen
   http://lyricslist.com/lyrics/artist_albums/56/bangles.php
   The Bangles Song Lyrics
   
 
   
   
   -- 
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
   
  
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2005-08-04 Thread Kristen G. Thorson

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.65br
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
63.87.252.162br
gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 
216.239.113.159br
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
63.87.252.162br



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Is gethostbyaddr() slow?

2005-08-04 Thread kalinga
On 8/4/05, Kristen G. Thorson [EMAIL PROTECTED] 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.65br
 gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
 63.87.252.162br
 gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 
 216.239.113.159br
 gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
 63.87.252.162br
 
 
 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
 
 
 
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php