Shanqing Cai
Shanqing Cai

Reputation: 3876

How to limit the number of instances UpStart can simultaneously start or respawn

I have a UpStart service job that has many (~100) instance that need to be started. Each of them is a resource-heavy process that does a lot of disk reading/writing during startup. When all of them start or respawn at the same time, they cause trouble due to excessive disk read/write requests.

I need a way to limit the number of instances that UpStart tries to start or respawn simultaneously. For example, is there a way to let UpStart hold off launching another instance until, say 30 seconds, after the startup or respawning of another instance has begun?

Upvotes: 8

Views: 384

Answers (2)

Kremnev Sergey
Kremnev Sergey

Reputation: 332

You can use pre-start or post-stop to pause after each job. E.g post-stop exec sleep 5

Upvotes: 1

Alex
Alex

Reputation: 6047

You can start them in sequence by using

start on started otherUpstartService

Upvotes: 5

Related Questions