Does the way you write cronjob affect the performance?

Hi guys, I am not so good in understanding the depth of cronjob. So, I have a question regarding cronjob. Please look at the below cronjobs and kindly tell me if they would affect the performance or the performance will be same in both cases 1st case

* * * * * executer /path/to/job1
* * * * * executer /path/to/job2
* * * * * executer /path/to/job3
* * * * * executer /path/to/job4
* * * * * (sleep 30; executer /path/to/job1)
* * * * * (sleep 30; executer /path/to/job2)
* * * * * (sleep 30; executer /path/to/job3)
* * * * * (sleep 30; executer /path/to/job4)

2nd case

          • executer /path/to/job1
          • (sleep 30; executer /path/to/job1)
          • executer /path/to/job2
          • (sleep 30; executer /path/to/job2)
          • executer /path/to/job3
          • (sleep 30; executer /path/to/job3)
          • executer /path/to/job3
          • (sleep 30; executer /path/to/job3)

Will the performance on both be same or they can be different? Thank you very much in advance for your help guys.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


It really depends on what the cron jobs are doing.

Using sleep to delay the start of the next cron job will allow resource usage to wind down if you’re doing something that’s resource intensive, which may provide better performance if the cron job will be using quite a bit of CPU.

For example, if one of the cron jobs is copying a large number of files from location X to location Y, it may be beneficial to delay the next cron job from running for a short period of time. Likewise, if you’re doing something really intensive that would cause CPU usage to rise, I/O wait to rise, etc – then yes, delaying the execution of the next cron job would be wise.

That being said, you may be better off simply setting up the delay in the cron job itself as opposed to in the command(s) being executed by the cron job.


* * * * *

… is equal to run every minute. You could setup more of a waterfall effect with the cron jobs and use the built in functionality of cron to simply manage the delay.

For example, you could run one every two minutes, one every four minutes, one every eight minutes, etc – you’d simply need to modify the first * and add a /# to it.

i.e. to run every second minute, you could use:

*/2 * * * * /path/to/script

The above will run 30x every 60 minutes (1 hour) – or every second minute.

For every 5 minutes, you could use:

*/5 * * * * /path/to/script

That’ll run 12x every 60 minutes (1 hour) – or every fifth minute.

Hi Jonathan, thanks a lot for taking time to write the answer. Much appreciated, brother. Here is what I am trying to achieve. I want to run the same script more than within a minute. Running it 3 times would be better. And yes, the process can be intensive because it will be sending emails to a bunch of users using postfix. What you think I should do to achieve that? Thank you very much for your help.