Hi, I have recently developed a free quite complex photo gallery software (see http://www.photography-on-the.net/ee/ ) with PHP/MySQL. It's quite near completion, only one odd server-related issue remains to be solved:
Two weeks ago the PHP code went suddenly really slow on my servers. I did not change source code - it just went slow. I usually get 80ms page parse speeds in my own Windows 2000 Pro 1.3Ghz/512MB PC. I used to get about 200-250ms on all online Linux servers I tried it on - that's ok for me because it has some really big queries there. To examine this sudden speed problem I set one test page on a shared server (Cobalt). I thought it was getting very busy (usually shared servers host about 200 sites at once) and that's why it went slow. See http://photography-on-the.net/gallery/list2.php , it makes a speed measurement on every block of code on a shared server. The page barely usable - and two weeks ago it was really fast. But it's not a server user load thing. A couple of days ago I got a _dedicated_ 1GHz/512MB/linux/Apache server (only with this one site in it so far), and put the same gallery there, and odd thing is that even if some parts of the code are now really fast and stable, there are still a few parts there that give very random parse delays like 300ms,1200ms, 800ms.... every time you refresh the page you get a different value - and the codes which seems to be have a problem are actually just few lines using simple print commands! The most complicated database queries and array shuffling goes in 1ms, but simple parts take ages? In fact I tried the ms counter only on one print command and it jumped randomly from 0 to 1000ms! See http://216.40.250.74/gallery/list2.php for a dedicated server parse times and tell me what the heck is going on there, please. E.g there is a code block called "TABLE HEADERS" which has only few print statements like this: ------- if ($sort_row==$q6) print $markedrow; print "><small><b><a href=\"list.php?sortby=1" . $link . "\"" . $remove_ . "><font color=\"#ffffff\">" . $s_APERTURE . "</font></a></b></small></td>"; ------- and it takes anything from 0 to 2000ms on a empty 1GHz Linux/Apache server without any traffic going on to parse it! My home server does it _always_ in 0ms. I thought the problem was perhaps in speed measurement code, but it's results reflect to actual page load speeds well. The "slow" parts of the code do not query any MySQL, only simple arrays are used there with some if statements and print commands. Can anyone explain this? Was there perhaps a new PHP hater kernel released for Linux couple of weeks ago or what's going on? Both servers, and my home dev server use PHP 4.06, I see no difference in configuration other that my server has "Virtual Directory Support" enabled and both Linux servers has it disabled (if that's it, what's Virtual Directory Support and how do you enable it?). The ms counter code I use is ----------- Function CheckTime ($VarStart, $VarEnd) { $arr = explode(" ", $VarStart ." ".$VarEnd); $ttime = "<small>It took ". round((($arr[2] + $arr[3]) - ($arr[0] + $arr[1])) * 1000) ."ms.</small><br>\n"; return $ttime; } $start = microtime(); // do table header stuff here // STOP PERFORMANCE CHECK $end = microtime(); // PRINT PERFORMANCE NOTE print "TABLE HEADER: "; echo CheckTime($start, $end); ----------- PS. Is there some other timer code available? Thanks for any insight, Pekka Saarinen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]