Scaling cronjobs on multiple servers

right now we have one server with a cronjob tab that sends daily emails. We would like to scale this server. The application is a standard zend application deployed on a centos server in the Amazon cloud.

We already took care of load balancing, content management, and deployment management. However, cronjob is still a problem for us, as we need to ensure that some tasks are performed only once.

For example, daily cronjob email should only be run once on a single server. I am looking for the best method for the recipient, only one server will execute it only once.

I am thinking of two solutions, but I was wondering if anyone has another problem.

  • Make one of the servers a “wizard” that only sends daily emails. This will be a problem if the server is faulty, and in general we do not want to have a “special” server. It also means that we will need to keep track of which server is the master.
  • Set the schedule task queue. Each server opens this queue and sees what tasks need to be completed. The first server to “capture” the task will complete the task and mark it as completed. I considered simple amazon queuing as a queue solution.

Both of these solutions have their advantages and disadvantages, and I was wondering if someone would think of someone who could help us here.

+5
3

cron, , Gearman

+5
0

. , , .

  • EC2 AWS.
  • cronjob (s) .
  • cron , /api (.. api.mydomain.com).
  • api , , , . , , , , cronjob, HTTP-.

, ! , , ! , cronjob only , .

0

All Articles