Re: Command-line PHP script CPU usage goes sky-high, stays there--why?
| From: | René Fournier | Date: | Tue, 11 Dec 2007 00:01:38 +0000 |
| Subject: | Re: Command-line PHP script CPU usage goes sky-high, stays there--why? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265642@lists.php.net to get a copy of this message | ||
On 10-Dec-07, at 4:42 PM, Tom Rogers wrote:
Put a usleep(1000) in the listen while() loop and give the cpu a break.Good advice, but I've already been doing that. The thing is, when the script first starts up, the CPU rarely exceeds 30%, even when many clients (200+) are simultaneously connected and sending data. When a few clients are connected, CPU is typically below 10%. Again, it's only after 24-48 hours that, all of a sudden, CPU usage increases by 40-50%. And it stays high until I stop the script and restart it. One question I have though is, is there actually any benefit to using mysql_pconnect(), since the script simply loops? My understanding is that pconnect only benefits if a script would otherwise be using mysql_connect repeatedly--and this script doesn't, since it calls mysql_[p]connect() just once, in the start tof execution. ...Rene