Cronjob

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I have a cronjob that runs a PHP script against MySQL.  The script takes 5
minutes to process 4000 records (approximately 12 records per second).  Here
are the top two entries from top:
  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
 8671 mysql     25   0 20172  19M  2000 R    97.8  3.9   2:02   0 mysqld
 8670 appmgr    15   0  2088 2088  1424 S     2.2  0.4   0:03   0 php

Is there a way that I can slow down the script so mysqld does not bog the
machine down.

Here is a snippet of code.  The function is called by the cronjob.
<snip>
function rank_mailbox_current($company_ID){
	$query = "select app_ID from mailbox where company_ID = \"$company_ID\"
		and deleted_date = 0 order by mailbox.ID desc";
	$result=query_database($query);

	while ($row = mysql_fetch_assoc($result)){
		$app_ID = $row["app_ID"];
		$rank_of_app=rank_app($app_ID,$company_ID);
	}
}
</snip>

Server: P-IV 2.4GHz, 512 DDRAM, RedHat 9
PHP Version 4.3.1
MySQL 4.0.3

Thanks,
Ryan

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux