0

If I understand right, Upstart runs all tasks that are ready to run in parallel.

However, is there a way to limit the amount of parallelisation? That is, the number of parallel tasks that are run should be capped by some constant.

For example, make allows you to run all tasks in parallel with the -j option. If you want to restrict the amount of parallel jobs, you can pass a number to it. Thus, -j 2 means run jobs in parallel but not more than two at a time.

I am looking for the equivalent setting in upstart.

Edit I just realized that my question is silly. If the jobs are daemons that never stop, then there is no way for Upstart to decide that they are done. Instead, what I need is a way to limit by disk i/o. That is, when disk i/o is high, upstart shouldn't spawn new jobs. It should only spawn after disk activity cools down.

2
  • @RamchandraApte Not sure what you mean. I don't know an answer yet.
    – HRJ
    Oct 8, 2013 at 13:21
  • well, there are many init scripts which are run by upstart and which are parallelism. Your question is valid, not silly. Also daemons typically are in disk sleep and consume almost 0% CPU, so upstart can spawn tens of daemons (actually a standard Linux system has many daemons running). so actually upstart probably ignores daemons in its "parallelism count". Oct 9, 2013 at 2:50

1 Answer 1

0

Have you looked at upstarts documentation? I strongly suggest to you to skim through it. It can be found here.

One simple way could be to delay some between each start or use a post-start script to delay until your service is up before you start next instance? Have a look at some of the examples to get some ideas how to handle it. Eg. 6.22 6.14.2 ++ http://upstart.ubuntu.com/cookbook/ You can also extend that script to suit your needs?

2
  • Yes, I did skim through the cookbook. What I need is a system-wide setting which throttles the parallel execution of all tasks. Right now, my hard disk is saturated during startup, which I believe is due to a large number of tasks getting spawned simultaneously.
    – HRJ
    Oct 8, 2013 at 13:25
  • 1
    @HRJ It's probably so because of ureadahead, which caches the hard disk into memory. Oct 9, 2013 at 2:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .