Re: [vserver] Guest hourly/daily/... cron job parallel execution

From: Bendtsen, Jon <Jon.Bendtsen_at_laerdal.dk>
Date: Thu 17 Jan 2013 - 09:36:03 GMT
Message-ID: <0323272F9AEDC74392AAC35180F56F6A53B3B0@NOSRV220.laerdal.global>

On 17/01/2013, at 10.07, Fiedler Roman <Roman.Fiedler@ait.ac.at>
 wrote:

>> -----Ursprüngliche Nachricht-----
>> Von: Bendtsen, Jon [mailto:Jon.Bendtsen@laerdal.dk]
>>
>> On 17/01/2013, at 09.43, Fiedler Roman <Roman.Fiedler@ait.ac.at> wrote:
>>
>>> Hello List,
>>>
>>> What would be the most suitable solution to avoid high load/overlong cron
>> job execution for hourly/daily/... jobs? When using similar vservers, all of
>> them would start those jobs at the same time.
>>
>> You could manually reschedule them?
>
> Manual reschedule is annoying, you need to estimate the run-time and make some job-start-plan to know free slots.

Or maybe just pick some random time, sort of what old ethernet did when there is a collision because 2 or more computers tried to transmit data at the same time.

>> Or use some kind of vserver <name>
>> exec cat /etc/crontab to find out when they are run and change them to run
>> at a different time?
>
> From my point of view, the 2 main advantages of this are:
> * Easy implementable, easy understandable solution
> * Lowest security impact/security-relevance of code
>
> The problem here ist the run-time estimate: Let assume, you have jobs in every guest, that need one CPU-core for 2min and 2 cores. So if 2 run, the complete in 2min, if 3 run in parallel they would need 3min, but due to more parallel disk IO, decreasing cache efficiency execution time could be more like 3:20. If stacking is too narrow, jobs deviating from estimate or additional jobs on guest or host are likely to make some jobs that slow, that execution overlaps with the next, thus decreasing the performance even further, thus starting more jobs in parallel …

I see your point. If so maybe we should split up daily/weekly/hourly cronjobs even further, such that all the same programs which are hard linked together can use the same cache and ram for instructions. But running locate to update the database might not be a good choice to all run at the same time.

Maybe we need kind of scheduler in the kernel that notices which processes in the different guests are hard linked and then prioritizing running those?

Maybe we need some new kind of scheduler system that is made with virtualization in mind, such that it adjusts to when there is a low load and then tries to run the maintenance scripts, meaning that sometimes scripts are run with only 20 hours between them, other times it might be 36 hours.

> On the other hand, if distance between jobs is quite large, the last guest daily jobs will run quite long after the first guest jobs have completed. So it might get narrow if all jobs should be finished between 0:00 and start of business hours.

Why start at 0:00? most people leave the office during the afternoon before the evening. I start my backup scripts at 18:00, but some people run a 24x7x365 business, so they can not just pick an off main hour schedule to do their business.

>> But maybe just using nice on all the commands in the guests will raise the
>> responsiveness, but not lower the load.
>
> This is sufficient to improve the customer-side performance but will decrease the execution efficiency of cron jobs even further. Would starting cron daemon with nice make all jobs run with the same nice-values?

I am not starting cron daemon with nice. I put nice in side the crontab file, like these examples:

37 0 * * * root nice -n 15 /usr/local/sbin/AD_integration/find_disabled_users_from_AD_in_groups.sh
0,15,30,45 * * * * root nice -n 5 /usr/local/sbin/AD_integration/merge_AD_groups_with_unix.sh

JonB
Received on Thu Jan 17 09:36:19 2013

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Thu 17 Jan 2013 - 09:36:19 GMT by hypermail 2.1.8