Re: [PHP] PHP slowness
I'm a little bit late in on this one, and asking questions after the problem is solved is a bit academic, but I am curious about one thing - Does the debian package do reverse lookups to try to get a name for the visiting IP address? Every page request taking 5 seconds sounds like a name lookup failure to me. regards Markus On Tuesday 01 March 2005 13:45, Gerard wrote: It looks like you are using Debian and probably did an apt-get install php. Why don't you try compiling php by hand without all the extra crap that I'm sure you don't need then try it. I think you will be much happier. Debian is great software, but when it comes to things like web services and php it is much better to compile by hand to get the best performance. Thanks for that one! After a manual compile it all works fine :D - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP slowness
On Thu, 24 Feb 2005 10:54:02 +0100, Gerard [EMAIL PROTECTED] wrote: Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. It looks like you are using Debian and probably did an apt-get install php. Why don't you try compiling php by hand without all the extra crap that I'm sure you don't need then try it. I think you will be much happier. Debian is great software, but when it comes to things like web services and php it is much better to compile by hand to get the best performance. Thanks for that one! After a manual compile it all works fine :D - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP slowness
Gerard wrote: I'm no expert on this stuff, but I'd be checking my swap space usage and RAM usage with 'top' or any other tools available... I suppose you probably already did that, but... Top shows that there's still normal non-swap memory available, so I don't think that's it. What exactly are you using in httpd.conf to make PHP work? Do you have any mod_rewrite rules going on in httpd.conf? Do you perhaps have mod_rewrite's engine LOGGING turned on, and cranked up really high, when rules that involve PHP kick in? Just a Wild Guess, but perhaps you have some real funkiness going on before PHP ever gets involved, it just LOOKS like a PHP problem. Another test: Did you happen to compile a PHP CGI/CLI at the same time as the PHP Module you are using? If so, how long does it take to run php -f /path/to/your/test/file.php from the command line? Granted, it's not EXACTLY the same code base as the PHP Module, but if that's fast and the Module is slow you have more indication that the problem is really *before* PHP kicks in. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP slowness
Hi there, just for testings sake, you should get a script that figures out the page generation time for a php script... As luck would have it, I made a class for this not too long ago. give this a whirl. First, create a php script with this in it... --snip-- It will color code it for you and everything, give it a whirl and let us know what it tells you. Good one. A simple index gives me this: 0.001297 seconds Which is normal. All it does is request a counter from the DB and add 1 to it. However, the page STILL takes 5 seconds to load. Or rather; for 5 seconds it does NOTHING and then it suddenly loads. This is not the case with .htm and .html files, they load at once... Somewhere there must be something which slows the execution of .php files for (exactly) 5 seconds. I just don't know what to think of this anymore :S - Gerard Gerard wrote: Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP slowness
Gerard wrote: Another interesting note; if you click from page to page fast enough, it doesn't take as long to load. For some reason, after the initial 5 second startup hic, it loads consequent pages smoothly. If you wait for 10 seconds and then click a link, it loads for 5 seconds again. I don't get this, especially since it seems to affect both PHP4 and PHP5... strace it and see what is going on. Compare the syscalls between a php request and a static request. There will be a clue in there somewhere. How would I go about stracing page requests? I never know which apache child is going to handle which page. -Rasmus - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP slowness
--snip-- I'm no expert on this stuff, but I'd be checking my swap space usage and RAM usage with 'top' or any other tools available... I suppose you probably already did that, but... Top shows that there's still normal non-swap memory available, so I don't think that's it. - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
Create profiling information for your application with pear's Timer class or something similar. regards, Bostjan On Saturday 26 February 2005 11:50, Gerard wrote: Hi there, just for testings sake, you should get a script that figures out the page generation time for a php script... As luck would have it, I made a class for this not too long ago. give this a whirl. First, create a php script with this in it... --snip-- It will color code it for you and everything, give it a whirl and let us know what it tells you. Good one. A simple index gives me this: 0.001297 seconds Which is normal. All it does is request a counter from the DB and add 1 to it. However, the page STILL takes 5 seconds to load. Or rather; for 5 seconds it does NOTHING and then it suddenly loads. This is not the case with .htm and .html files, they load at once... Somewhere there must be something which slows the execution of .php files for (exactly) 5 seconds. I just don't know what to think of this anymore :S - Gerard Gerard wrote: Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
Did you try rotating your logs so your logs are fresh? Randy Gerard wrote: --snip-- I'm no expert on this stuff, but I'd be checking my swap space usage and RAM usage with 'top' or any other tools available... I suppose you probably already did that, but... Top shows that there's still normal non-swap memory available, so I don't think that's it. - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
Gerard wrote: How would I go about stracing page requests? I never know which apache child is going to handle which page. Run Apache in non-forking mode with -X -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP slowness
Hi Brent, I noticed you have your error_reporting level set really high (2039), which is pretty close to everything. That may be fine on a development server, but I wouldn't set it that high on a production server. I'd be curious what you log looks like. Perhaps this is causing your slowness, perhaps not. This is obviously not it, I changed the reporting level to nothing and still no go. Also, you seem to use the short open tag style '?'. Not that it's causing your problem, but for compatibility you should probably use the long style '?php'. Thanks for the tip, I'll keep that in mind. Update on the issue: I just upgraded to PHP5 in an attempt to get the speed under control, it didn't work. What I did notice is that even www.debuginc.com/test2.php (which has NO code in it at ALL, only text) takes 5 seconds to load! Upon closer investigation, it seems that with both PHP4 and PHP5, any page that ends on .php takes 5 seconds doing NOTHING before it starts to process and actually load... What could delay any given .php page for 5 seconds on both PHP4 and PHP5? It doesn't seem to make any sense. I already removed unused CGI modules from the Apache load process, but still a 5 second delay. Another interesting note; if you click from page to page fast enough, it doesn't take as long to load. For some reason, after the initial 5 second startup hic, it loads consequent pages smoothly. If you wait for 10 seconds and then click a link, it loads for 5 seconds again. I don't get this, especially since it seems to affect both PHP4 and PHP5... - Gerard On Feb 24, 2005, at 4:54 AM, Gerard wrote: Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
I think I have heard that your system can get really bogged down if your log files are HUGE. So you probably are right. I dread the size of the log files if he has a rather busy site and is logging everything... Randy Brent Baisley wrote: I noticed you have your error_reporting level set really high (2039), which is pretty close to everything. That may be fine on a development server, but I wouldn't set it that high on a production server. I'd be curious what you log looks like. Perhaps this is causing your slowness, perhaps not. Also, you seem to use the short open tag style '?'. Not that it's causing your problem, but for compatibility you should probably use the long style '?php'. On Feb 24, 2005, at 4:54 AM, Gerard wrote: Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- 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] PHP slowness
Hi there, just for testings sake, you should get a script that figures out the page generation time for a php script... As luck would have it, I made a class for this not too long ago. give this a whirl. First, create a php script with this in it... ?php // CREATE THE CLASS class page_gen { // CLASS VARIABLES var $start_time; var $end_time; var $gen_time; // USER DEFINE VARIABLES var $color_good; var $color_fair; var $color_poor; // FIGURE OUT THE TIME AT THE BEGINNING OF THE PAGE function start() { $this-start_time = microtime(); } // FIGURE OUT THE TIME AT THE END OF THE PAGE function stop() { $this-end_time = microtime(); } // CALCULATE THE DIFFERENCE BETWEEN THE BEGINNNG AND THE END AND COLOR CODE THE RESULT function gen() { $this-gen_time = $this-end_time - $this-start_time; if (!isset($this-color_good)) { $this-color_good = green; } if (!isset($this-color_fair)) { $this-color_fair = yellow; } if (!isset($this-color_poor)) { $this-color_poor = red; } if ($this-gen_time = 0.09) { $this-gen_time = span style=\color: $this-color_good;\$this-gen_time/span; } elseif ($this-gen_time = 0.9 $this-gen_time 0.09) { $this-gen_time = span style=\color: $this-color_fair;\$this-gen_time/span; } elseif ($this-gen_time = 9. $this-gen_time 0.9) { $this-gen_time = span style=\color: $this-color_poor;\$this-gen_time/span; } print(span style=\font-weight: bold;\$this-gen_time/span seconds); } } ? Now, put this code at the top of the page you want to time. ?php require(cls.pagegen.php); // or whatever you named it $gentime = new page_gen(); $gentime-start(); ? Where you want to stop timing (usually at the bottom). ?php $gentime-stop(); ? Now to display the time, simply go ?php $gentime-gen(); ? It will color code it for you and everything, give it a whirl and let us know what it tells you. Gerard wrote: Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
Gerard wrote: Hi Brent, I noticed you have your error_reporting level set really high (2039), which is pretty close to everything. That may be fine on a development server, but I wouldn't set it that high on a production server. I'd be curious what you log looks like. Perhaps this is causing your slowness, perhaps not. This is obviously not it, I changed the reporting level to nothing and still no go. Also, you seem to use the short open tag style '?'. Not that it's causing your problem, but for compatibility you should probably use the long style '?php'. Thanks for the tip, I'll keep that in mind. Update on the issue: I just upgraded to PHP5 in an attempt to get the speed under control, it didn't work. What I did notice is that even www.debuginc.com/test2.php (which has NO code in it at ALL, only text) takes 5 seconds to load! Upon closer investigation, it seems that with both PHP4 and PHP5, any page that ends on .php takes 5 seconds doing NOTHING before it starts to process and actually load... What could delay any given .php page for 5 seconds on both PHP4 and PHP5? It Are you using auto_prepend_file in your php.ini? It will load up the named file before *every* php script and could be your culprit. Yes, it's been around since PHP4 too. doesn't seem to make any sense. I already removed unused CGI modules from the Apache load process, but still a 5 second delay. Another interesting note; if you click from page to page fast enough, it doesn't take as long to load. For some reason, after the initial 5 second startup hic, it loads consequent pages smoothly. If you wait for 10 seconds and then click a link, it loads for 5 seconds again. That seems backward to me, but maybe that's just because I don't understand Apache well enough (Rasmus, where are you? :) Does Apache cache the content of CGI scripts and/or is it able to look for the compiled script in memory? I would expect script startup time would decrease for scripts running through the Apache module, but not the CGI. Or am I missing something here? I don't get this, especially since it seems to affect both PHP4 and PHP5... - Gerard -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
RE: [PHP] PHP slowness
Gerard wrote: Update on the issue: I just upgraded to PHP5 in an attempt to get the speed under control, it didn't work. What I did notice is that even www.debuginc.com/test2.php (which has NO code in it at ALL, only text) takes 5 seconds to load! Upon closer investigation, it seems that with both PHP4 and PHP5, any page that ends on .php takes 5 seconds doing NOTHING before it starts to process and actually load... What could delay any given .php page for 5 seconds on both PHP4 and PHP5? It doesn't seem to make any sense. I already removed unused CGI modules from the Apache load process, but still a 5 second delay. Another interesting note; if you click from page to page fast enough, it doesn't take as long to load. For some reason, after the initial 5 second startup hic, it loads consequent pages smoothly. If you wait for 10 seconds and then click a link, it loads for 5 seconds again. I don't get this, especially since it seems to affect both PHP4 and PHP5... That sounds to me like maybe you're out of RAM and doing a hell of a lot of swapping. If every URL you surf to forces the OS to hit the hard drive to re-load the memory page that has PHP in it, ... I'm no expert on this stuff, but I'd be checking my swap space usage and RAM usage with 'top' or any other tools available... I suppose you probably already did that, but... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
Gerard wrote: Another interesting note; if you click from page to page fast enough, it doesn't take as long to load. For some reason, after the initial 5 second startup hic, it loads consequent pages smoothly. If you wait for 10 seconds and then click a link, it loads for 5 seconds again. I don't get this, especially since it seems to affect both PHP4 and PHP5... strace it and see what is going on. Compare the syscalls between a php request and a static request. There will be a clue in there somewhere. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP slowness
Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP slowness
I noticed you have your error_reporting level set really high (2039), which is pretty close to everything. That may be fine on a development server, but I wouldn't set it that high on a production server. I'd be curious what you log looks like. Perhaps this is causing your slowness, perhaps not. Also, you seem to use the short open tag style '?'. Not that it's causing your problem, but for compatibility you should probably use the long style '?php'. On Feb 24, 2005, at 4:54 AM, Gerard wrote: Hello people, Recently, one of my webservers became rather slow. At first we thought it was the MySQL backend, but when logged in on MySQL using the command line tool over SSH, it runs as smooth as ever. Static content (normal html pages) also load without delay. It seems that the bottleneck is PHP itself. For the sake of comparison, I created 2 test pages: http://www.debuginc.com/test.html http://www.debuginc.com/test.php Everyone I asked says that the PHP page takes over 5 seconds to load while the HTML one instantly displays. The only code in the PHP page is ? echo 'hello world'; ?. No MySQL stuff, so that eliminates the initial idea of MySQL causing the slowness. Nevertheless, it IS slow and I have no idea why or where to start looking. The phpinfo() can be found on www.debuginc.com/info.php. Any help or hints are highly appreciated. Another interesting note; this problem started a couple of days ago without any changes in the config or anything. At first I upped the amount of connections Apache would accept, but it soon turned out that was not the problem. Thanks, - Gerard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php