RE: [PHP] CPU usage @5% during 2 minutes

2004-10-20 Thread Janke Dávid
2004-10-20, sze keltezssel 00:19-kor Ed Lazor ezt rta:
  How any rows are you pulling from the database?  
  aprrox. 12.000 but there are only around 50-100 new rows at a
maximum
  within a day, and there were almost as many before the 
  problem appeared.
 
 You're creating a form with over 12,000 options in a select statement?

Unfortunately yes. This is a serial code from a paper form. Because they
want to be able to select each form individually from on page there is
no other way.
(maybe I should implement an archivating function)


 Have you tried to increase the amount of memory available to this
script?

Yes.
I have set it to 64M, but it didn't seem to work.
It is strange, that now I have set it to -1 (according to the php doc
this is the value for unlimited memory access). Now it is faster. But by
now I can't say how fast it really is. The customer will say it
tomorrow.

Thanks very much for the help by now

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



Re: [PHP] CPU usage @5% during 2 minutes

2004-10-20 Thread Janke Dávid
HLP!

This becomes more and more strange. Aftar I was really happy, that the
code runs fast again, the customer sent an e-mail that is still slow.
So I logged in into his network and everything was ok for me, but when
they tried to use the program, I still saw (using top), that the CPU
usage is still @5% (highest value).
So I began to use the debug log of apache, and see what happened (LOOK
AT THE LAST NUMBER, WHICH SHOWS HOW LONG THE SCRIPT RUN):

In this case I was using it from the localhost:
10.36.0.5 - - [20/Oct/2004:14:27:25 +0200] GET
/form.php?op=reprint_form_sel HTTP/1.1 200 1478211 - Links (0.99;
Linux 2.6.8-1-686 i686; 80x24) 17970 3

In this case I was using it from another host in the network (actually
the proxy):
10.36.0.2 - - [20/Oct/2004:14:23:33 +0200] GET
/bizerba/form.php?op=select_form HTTP/1.0 200 1473492 -
Lynx/2.8.5rel.1 libwww-FM/2.14
SSL-MM/1.4.1 GNUTLS/0.8.12 17969 7

In this case the some other client was using it from the network:
10.36.0.2 - - [20/Oct/2004:14:33:23 +0200] GET
/bizerba/form.php?op=select_form HTTP/1.0 200 1473492 - Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.1) 17970 36

No, it is not the network, which is slow!

Is it possible, that all clients (except me) are accessing it throug a
proxy and some proxy settings were changed, so the webserver is running
slower? (of course this wouldn't excplain the fact, the the code ran
slower on other machines too).

David

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



Re: [PHP] CPU usage @5% during 2 minutes SOLVED

2004-10-20 Thread Janke Dávid
Hi all!

After 2 weeks of sleepless nights and visiting the customer three times
(once on saturday) the problem is solved.

The thing was:
The new, 20 year old administrator guy set all clients to use the local
network via the proxy. And the proxy wasn't able to handle the approx.
1,5MB huge web pages.

So after ensuring me two weeks ago, that their local network is perfect
they'll get a nice little bill.

Thank at all.

David

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



[PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
Dear php list!

I have a real big and strange problem I ran into few weeks ago.
One of my clients complained, that the intranet software began to run
very slow, almost unusable.
Since then I have almost tried everything to get the thing work.

The facts:
On P3 architecture systems (I have tried 3, including the server at the
clients office) runs very slow and with about 0-5% of CPU usage. The
code needs about 2 minutes to get completed.
On a P4 it is ready in 2 seconds with 100% CPU usage.

I have placed a debug function into the code. It is a string that
collects unix microtime each time within the loop. This loop has approx.
10k cycles. The loop does nothing than echoing a row. Sometimes there is
a 4 second gap between two cycles, sometime only a few microseconds.

The original system was installed from Debian Woody, but the problem
appears on a Sarge system, and when using apachephp compiled by me.
No configuration file fine tuning seems to work.

The most strange thing is, that the problem appeared at a time, when no
changes to the program was made.

ANYBODY RAN INTO SOME SIMILAR THING?

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
The sample code (in seperate, this piece of code runs with normal speed,
but it is this part which runs slowly when executed as a whole,
everything else is fast):


$sqlquery = SELECT sh_Number, sh_Status FROM service_sheet ORDER BY
sh_Number DESC;
$result = mysql_query($sqlquery)
or die (mysql_error().brbr._ERROR_QUERY.: .$sqlquery);
echo  SELECT onchange=\this.form.service_sheet_worknum.value =
this.value;\ class=\service_sheet_list\ name=\service_sheet\;
while (list($shID, $shStatus, $shWNum, $custName) =
mysql_fetch_row($result)) {
switch ($shStatus) {
case 1:
$option_class = status_1;
break;
case 2:
$option_class = status_2;
break;
case 3:
$option_class = status_3;
break;
case 4:
$option_class = status_4;
break;
case 5:
$option_class = status_5;
break;
}
echo OPTION class=\$option_class\ value=\$shID\$shID/OPTION;
}
 echo /SELECTnbsp;nbsp;nbsp;nbsp;._OR;?

 

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
How any rows are you pulling from the database?  
aprrox. 12.000 but there are only around 50-100 new rows at a maximum
within a day, and there were almost as many before the problem appeared.

What's the very last part of the code:  .$_OR? 

There is a switch, some echoes and a db_close;


Have you tried this code in a separate script to test it's performance
individually?
Yes, then it performs good.
This seems to be strange and irrelevant to me, because placing a 
$tmpsting .= microtime().br\n; into each loop and then echoing it
shows, that there are randomly processing gaps between two cycles when
running as a part of the whole.



 -Original Message-
 
 The sample code (in seperate, this piece of code runs with 
 normal speed,
 but it is this part which runs slowly when executed as a whole,
 everything else is fast):
 
 
   $sqlquery = SELECT sh_Number, sh_Status FROM 
 service_sheet ORDER BY
 sh_Number DESC;
   $result = mysql_query($sqlquery)
   or die (mysql_error().brbr._ERROR_QUERY.: .$sqlquery);
   echo  SELECT 
 onchange=\this.form.service_sheet_worknum.value =
 this.value;\ class=\service_sheet_list\ name=\service_sheet\;
   while (list($shID, $shStatus, $shWNum, $custName) =
 mysql_fetch_row($result)) {
   switch ($shStatus) {
   case 1:
   $option_class = status_1;
   break;
   case 2:
   $option_class = status_2;
   break;
   case 3:
   $option_class = status_3;
   break;
   case 4:
   $option_class = status_4;
   break;
   case 5:
   $option_class = status_5;
   break;
   }
   echo OPTION class=\$option_class\ 
 value=\$shID\$shID/OPTION;
   }
echo /SELECTnbsp;nbsp;nbsp;nbsp;._OR;?
 

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
2004-10-19, k keltezssel 23:38-kor Jennifer Goodie ezt rta:
 -- Original message from Janke Dvid : -- 
 
  The sample code (in seperate, this piece of code runs with normal speed, 
  but it is this part which runs slowly when executed as a whole, 
  everything else is fast): 
  
  
  $sqlquery = SELECT sh_Number, sh_Status FROM service_sheet ORDER BY 
  sh_Number DESC; 
  $result = mysql_query($sqlquery) 
  or die (mysql_error().
 
 Are you sure it is not the query that is running slow?  Have you looked to see what 
 mysql is doing when the application hangs?  What processes does top show as running 
 and using resources?  Has the mysql config recently changed?  What does an explain 
 on that query show?

Yes. And although I don't like mysql I must say, that the query runs
damned fast. 11341 rows in 0.23 seconds.

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



RE: [PHP] CPU usage @5% during 2 minutes

2004-10-19 Thread Janke Dávid
2004-10-20, sze keltezssel 00:19-kor Ed Lazor ezt rta:
  How any rows are you pulling from the database?  
  aprrox. 12.000 but there are only around 50-100 new rows at a maximum
  within a day, and there were almost as many before the 
  problem appeared.
 
 You're creating a form with over 12,000 options in a select statement?

Unfortunately yes. This is a serial code from a paper form. Because they
want to be able to select each form individually from on page there is
no other way.
(maybe I should implement an archivating function)


 Have you tried to increase the amount of memory available to this script?

Yes.
I have set it to 64M, but it didn't seem to work.
It is strange, that now I have set it to -1 (according to the php doc
this is the value for unlimited memory access). Now it is faster. But by
now I can't say how fast it really is. The customer will say it
tomorrow.

Thanks very much for the help by now

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