Re: [PHP] Odd parse speed problem in 4.06/Linux/Apache

2002-01-31 Thread charlesk

I noticed a similar thing so I started performance logs on all php scripts.  
I found that the same User (IP/User Agent) could request a file and it would usually 
run around .01 seconds.  Every once in a while though it would jump to 30+ seconds.
Not a server load issue because it sometimes happens after midnight.  The lowest point 
of the day.
No runaway processes, cant be buggy code because the same script with same parameters 
runs fine other times.

I dug into it for a while and never found a solution.

I posted a bug on php.net and they coulnd't help.

I cant reproduce it.
It continues to happen and we are continuing to monitor it.

Charles Killmer
Windows 2000 Server, PHP 4.1.0, IIS 5.0

-- Original Message --
From: Pekka Saarinen [EMAIL PROTECTED]
Date: Wed, 30 Jan 2002 18:27:43 +0200

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 smallba href=\list.php?sortby=1 . $link . \ . $remove_ . 
font color=\#ff\ . $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 = smallIt took . round((($arr[2] + $arr[3]) - ($arr[0] + 
$arr[1])) *
1000) .ms./smallbr\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]



-- 
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]




[PHP] Odd parse speed problem in 4.06/Linux/Apache

2002-01-30 Thread Pekka Saarinen

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 smallba href=\list.php?sortby=1 . $link . \ . $remove_ . 
font color=\#ff\ . $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 = smallIt took . round((($arr[2] + $arr[3]) - ($arr[0] + 
$arr[1])) *
1000) .ms./smallbr\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]