My cron job was running very slowly so I looked at the “Running Processes” and see that
although I only have 8 processes running, the auto_cb_update.php is only getting 2.9 %
of the processor to use so is consequently running very slow.
I have run this job many times before and it usually gets between 30 and 70 %
The process usually takes 4 minutes, it has been running for 15 mins already and not finished
First, it’s very unlikely that all the processes would ever add up to 100%. Looking in the “ps” manpage, the CPU time expressed is:
“CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process.”
Second, I don’t know anything at all about auto_cb_update.php, so I’m not sure what it does, or what factors could cause it to run slower. For example, it could be a bug or design in a new version of the app that was recently installed.
This is where it gets tough to diagnose… a common factor as to why it would run slower is if its waiting on something else.
That could be a lot of things –
If your server is doing more things than previously, you may be using more disk IO. And when there’s less disk IO to go around, processes that require disk access take longer to run.
If that process is making use of MySQL, if there’s more database entries it has to sort through than previously, that could certainly cause it to take longer to run.
If you’re running all this on a VPS rather than a dedicated server, other VPS users on your same hardware may be using more CPU or disk IO, making less available to you.
With all that in mind – does it actually matter how long it takes to run? Can you put it in to run at 2am or 3am, knowing that it’ll start after you go to sleep, and be finished before you get up?