Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using Solaris 10, and I am adding many cronjobs to my server's crontab.

Currently I have 30 cronjobs in my crontab.

one cronjob takes 8 hours to complete ,one other cron job takes 5 hours to complete it and rest of them are ordinary cronjobs (max 30 mins they take)

As it is a production server, I am worried about server's performance.

  1. How are they related to the performance of my server?
  2. Is there any upper limit for number of cronjobs?
share|improve this question
1  
I'd say the overhead of cron itself is not too big (i.e. checking once per minute if one of your 30 lines in the crontab applies). That might be relevant if you have hundreds or thousands of cronjobs. As @sr__ very rightly points out, the jobs itself do impact performance. –  Ulrich Schwarz Jan 27 '12 at 11:51
1  
This question could be much improved by noting the type of tasks you are trying to accomplish. I suspect there is something in 8 and 0.5 hour cronjobs that could be done far more efficiently (I'm also kinda curious). –  msw Jan 27 '12 at 14:03
    
now I am clear what to ask I will ask it as another question –  Balaswamy vaddeman Jan 28 '12 at 5:40

2 Answers 2

up vote 6 down vote accepted

Short answer: Yes.


Longer answer:

  1. Depends on what the cronjobs do and when they do it, i.e. computation-heavy (performance-degrading) tasks run at night (or when no one is in the office, depends on what the server is used for) don't hurt (if they're finished before office hours, of course).
  2. If there is a limit (I'm not sure), it's probably way beyond 30. Anyways, it seems a little uncommon to have that many cronjobs (someone correct me if I'm wrong), but without more information, it's impossible to say if there's a better solution.

(This is just a first approximation to an answer, I doubt it can be fully answered in this generality.)

You could also read up on nice (not sure if it exists on Solaris). The Solaris Resource Management (1), (2) also sounds useful, depending on the type of your jobs.

share|improve this answer

Of course the cron jobs will affect performance in some way. If a cron job takes 8 hours, it's presumably doing something big. But what? Therein lies the question.

If you have several background jobs that compete for resources, they will take longer to complete. For example, if you have an 8-hour job and a 5-hour job taken separately, they may take more than 13 hours if you run them at the same time and they're fighting for the same resource (disk I/O, network bandwidth, RAM, …). Conversely, if they use different resources (e.g. one is CPU-bound, the other is disk-bound), it's possible that they'll both be finished by 8am if you start them at midnight.

So the rule to space out intensive jobs is to allocate resources widely. Figure out what each job needs (disk I/O, network bandwidth, RAM, CPU, …) then work out a schedule so that there is no contention for resources. For example, if you have 4GB of RAM and job #1 requires 2GB, jobs #2 and #3 require 2GB each and normal server operation requires 2GB, then make sure job #1 doesn't run at the same time as jobs #2 and #3, but it's ok to run #2 and #3 simultaneously. You should usually run a single disk-intensive job at a time, unless you have different jobs that hit different disk pools. CPU can be shared with no overhead, just make sure you have some left for front-end operation (nice can help there).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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