I have a scheduled task that runs a script on a regular basis (every hour). This script does some intense interaction with the database and file system and takes several minutes regularly. The problem is that when using the script, the cpu-use processor runs and normal operation slows down. Is there a way to throttle this process so that it takes longer, but does not consume so many resources?
I looked at various configuration options for PHP, but it seems that not everything fits my needs.
Setting memory_limit in php.ini to something lower causes data objects to overflow quite easily.
I saw similar entries in which people suggested using sleep () at specific points in the script, but this does not prevent the script from tearing itself away from the server.
The best solution would be to somehow tell the Glass (in this case Wamp) glass to use only 10% of the maximum CPU usage. I'm not worried about runtime at all, and would prefer it to take longer if that means saving CPU cycles per second. My alternative solution would be to configure another server with database replication so that cron can go to the city without slowing down everything else.
Environment: Windows Server 2k3, Apache 2.2.11, PHP 5.2.9, MySQL 5.1
I appreciate any understanding of this situation.
EDIT: I appreciate all the answers, even those that are * nix-specific. It's still early enough in my situation to change the placement environment. Hope this question helps others regardless of OS.
php cron wamp lamp
Mike b
source share