tags:

views:

25

answers:

0

I have a PHP script that goes thru all urls in the database, checks which http code they return and then update the row. It's a simple do/while loop. In each iteration it fetches url and uses curl_getinfo() to get headers.

Script worked great but after a while I noticed that PHP was using 99% CPU and speed of one check was really, really slow. I aborted the script and started over but now it always uses 99% CPU and doesn't work properly. I get timeouts on urls that I know are working.

The script hangs between curl_getinfo() and curl_close(). My Curl class is really simple and it doesn't have any loops or anything. Basically it's just simple get() method that initializes all parameters with curl_setopt() and then does curl_exec() or curl_getinfo().

I really can't figure it out what's causing CPU to spike. There's nothing looping or anything that the script could be computing. I just upgraded Curl to 7.21.0 but didn't help.