[PHP] Performance Problem
Hi all, I've been chasing what I think is the same performance issue for about a year and it's driving me batty. First off, the server is a dual core 2.8 P4 with 2G RAM running RHEL5 hosted at The Planet and is under very light load. This problem started last year while the server was RHEL4 and I completely rebuilt it with RHEL5. The PHP-based sites hosted on the server have shown intermittent performance issues when loading. A page might load fine 2 or 3 times, then take 5-10 seconds to complete the next page load. I've gone through everything top-to-bottom to try to eliminate possibilities: First thought was MySQL, so I took that out of the equation and tested pages that didn't use the database and that had no effect. Second though was httpd, so I compared straight HTML with PHP, and found the problem only occurred with the PHP pages. Straight html had no issues, so it's definitely a PHP problem. I've been compiling my own PHP with MySQL binary releases, so to make sure I wasn't causing the problem, I rolled back to RHEL5 httpd, php, and mysql. I even used the RPM's php.ini to try to rule everything out. To try and quantify the issue, I made a PHP page that just had a one-line echo and compared it with a regular html page and ran httperf tests with the following values (run from the server to take network issues out of the equation): httperf --hog --num-conn 100 --ra 10 --timeout 5 The html page always ran with no errors: Connection time [ms]: min 0.2 avg 0.4 max 13.7 median 0.5 stddev 1.4 Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 On the other hand, the PHP on successive attempts: Connection rate: 6.9 conn/s (145.0 ms/conn, =31 concurrent connections) Connection time [ms]: min 83.3 avg 585.4 max 2215.0 median 406.5 stddev 510.6 Reply status: 1xx=0 2xx=70 3xx=0 4xx=0 5xx=0 Errors: total 30 client-timo 30 socket-timo 0 connrefused 0 connreset 0 Connection rate: 10.0 conn/s (99.7 ms/conn, =6 concurrent connections) Connection time [ms]: min 25.7 avg 232.1 max 1443.4 median 141.5 stddev 244.0 Reply status: 1xx=0 2xx=100 3xx=0 4xx=0 5xx=0 Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0 Connection rate: 6.8 conn/s (148.0 ms/conn, =47 concurrent connections) Connection time [ms]: min 107.4 avg 1066.1 max 1989.7 median 1201.5 stddev 519.5 Reply status: 1xx=0 2xx=22 3xx=0 4xx=0 5xx=0 Errors: total 78 client-timo 78 socket-timo 0 connrefused 0 connreset 0 As you can see, it's all over the place and it shouldn't really be taxing it enough to cause problems on that server. At this point, I don't know what else to do. If anyone can shed any light on this, I'd be forever grateful. I'll try anything and do whatever I can on my end to fix this. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance Problem
I know my original post was long-winded, but I did mention that my php tests were run on a single-line PHP script that simply echoed hi so it couldn't get much simpler than that. But for thoroughness' sake, I've run the tests against a test file with a php extension with no PHP code at all, and it suffers the same performance problems/ The only modules loaded for the tests were gd, mysql, pdo. For what it's worth, I help manage several RHEL servers at my day job that run similar hardware and far more bloated PHP builds that have no performance issues whatsoever. And also, for what it's worth, none of the other services on the server have problems. On Feb 27, 2008, at 1:00 PM, Daniel Brown wrote: On Wed, Feb 27, 2008 at 12:39 PM, Adriano Manocchia [EMAIL PROTECTED] wrote: Hi all, I've been chasing what I think is the same performance issue for about a year and it's driving me batty. First off, the server is a dual core 2.8 P4 with 2G RAM running RHEL5 hosted at The Planet and is under very light load. This problem started last year while the server was RHEL4 and I completely rebuilt it with RHEL5. [snip all of the good stuff --- thanks for a well-written question!] Adriano, It really depends on what PHP is expected to do prior to serving the content. Some things to consider: Are you loading a bunch of modules in your php.ini? What is the script doing? Is it reading/writing files? Including files? If so, are they local or remote? What happens if you take a static HTML page and rename it with a .php extension and compare load times? The last of the questions will be of the most help in determining which of the first two would be more applicable, because when you rename the extension, PHP will be loaded by Apache. This means: a.) If the performance is degraded by comparison, it's a slow-loading PHP engine. b.) If the benchmarks are comparable, then it's likely something in your PHP script(s). -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance Problem
I'm trying to get it working but it doesn't seem to want to write the profile info at the moment. Correct me if I'm wrong, but wouldn't this just show problems within actual code? If the problem is occurring on a PHP file with no PHP in it whatsoever, it seems to fall outside the scope of what xdebug would show. On Feb 27, 2008, at 1:32 PM, Eric Butera wrote: Try using Xdebug[1] with the xdebug.profiler_aggregate = 1 switch. This will allow you to see a generalized overview of all the different requests of your site. This way you can spot a weakness in your bootstrapping problem vs a single page being slow. [1] http://www.xdebug.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance Problem
OK. I just went through about 10 minutes' worth of cachegrinds, including several httperf tests on that empty php file (which had the usual poor results). According to the cachegrind files, nothing (including the other active web pages) took more than 15ms and the empty php file never exceeded 1ms. Clearly it's not having problems once it gets to processing the files. The issue seems to lie elsewhere with PHP. On Feb 27, 2008, at 1:32 PM, Eric Butera wrote: Try using Xdebug[1] with the xdebug.profiler_aggregate = 1 switch. This will allow you to see a generalized overview of all the different requests of your site. This way you can spot a weakness in your bootstrapping problem vs a single page being slow. [1] http://www.xdebug.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance Problem
Well, I just spent more time messing with httpd's conf and it the problem seems to have resolved itself by turning off hostname lookups. I know there's overhead associated with it, but I don't really understand why it only affected PHP, and so drastically. At any rate, I guess this issue is solved. Thanks for the help. Adriano -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Performance Problem
Whoa. No need to get snippy. I was being sincere in my gratitude for the suggestions. If nothing else, I'm sure I'll be making more use of Xdebug in the future. On Feb 27, 2008, at 3:55 PM, Shawn McKenzie wrote: Adriano Manocchia wrote: Well, I just spent more time messing with httpd's conf and it the problem seems to have resolved itself by turning off hostname lookups. I know there's overhead associated with it, but I don't really understand why it only affected PHP, and so drastically. At any rate, I guess this issue is solved. Thanks for the help. Adriano Yes, we all knew exactly what your problem was. Sorry we didn't post quicker ;-) -Shawn -- 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