Hosting provider warns me about server CPU overload due script
Submitted by Al on Fri, 2009-07-03 09:44.Price Tapestry
My hosting provider has canceled all Cron jobs due to: shared hosting server heavy overload. CPU was used for 100%
I am running three scripts, once a day with a few hours interval.
The importall.php
<?php
header("Content-Type: text/plain");
passthru("php ../scripts/import.php @MODIFIED");
?>And another one which downloads the feeds first and the imports them automatically. I must say there are some large feeds.
What can I do about this?
Hello Al,
The first tip for reducing load during import, if at all possible depending on your setup, is to use import.php @ALL instead of @MODIFIED. This is because deleting thousands of rows from an already very large is a very slow process.
However, I appreciate that it might not be desirable to have your site down for as long as it takes to perform the import, so there is a very nice modification described in the following thread that imports to a temporary table, and once completed switches it over to the live table. This will mean that you can then use @ALL without interruption to your site:
http://www.pricetapestry.com/node/2554#comment-10312
In addition, several users have found that inserting a 1 second sleep() every 100 products or so during the import also make a significant difference...
http://www.pricetapestry.com/node/1216
If you're not sure about any of the above modifications, email me the files across and I'll patch them for you...
Cheers,
David.