0

We are facing really big issue with the cron. Our site is running on 2 ec2 instances under the load balancer. We have lot of cron tasks which are performed every day. But the problem comes when the cron run, during this time all instances start processing the cron jobs, and site will not be accessible for the users. Here all the instances are sharing the same db including the staging instances(another 2 instances). I don't understand that, why all instance's CPU utilization is going high when cron run(all 4 instances).

Because of this behavior, what we are planning now is, to move the cron to a separate server, there it will perform all the jobs. But I'm not sure how I can achieve this.

How can I move the cron job to a separate server?

0

Instead of moving cron, you need to look into what parts of cron are so CPU itensive and why it takes such a long time to complete.

You can start by logging executed tasks, how when they start, finish and a comment about what they do.

  • My question is not only about the CPU usage, Why all instances are running the cron tasks?. This is what giving me the headache. I just want to run the cron taks in one instance. – SkyBuzz Nov 24 '15 at 12:26
  • Do you have any idea about how to run the cron in one instance. – SkyBuzz Nov 24 '15 at 12:53
  • It all depends on SQL since cron creates its locks in SQL: SELECT * FROM from variable WHERE name like "cron%"; Are you running on single SQL database on both instances? – gcardinal Nov 24 '15 at 12:56
  • Yes, All the instances are sharing the same DB. – SkyBuzz Nov 24 '15 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.