开发者

How can I setup a system where I am warned when my Heroku app has more than certain amount of delayed_jobs queued?

开发者 https://www.devze.com 2023-02-16 04:30 出处:网络
I use Delayed Jobs a lot in my Heroku app. I\'d like to setup some kind of alert when there\'s a certain amount waiting to be p开发者_JS百科rocessed, so that I can increase the amount of workers to mi

I use Delayed Jobs a lot in my Heroku app. I'd like to setup some kind of alert when there's a certain amount waiting to be p开发者_JS百科rocessed, so that I can increase the amount of workers to minimise the wait time for my users. Has anyone done this before?


You could create a Model for the table i guess and keep and eye on the count of items in the table each time you add a job to it, or perhaps each time a job completes. Depending on the count you could trigger an email to be sent to alert you of the number of items building up in the table.

I spotted Hirefire today too. It might be of interest to you, it would certainly help automate the scaling proceess for you without doing the aforementioned. I haven't tested the Hirefire gem myself yet though so it might not be what you need.


I'm the author of HireFire and you could indeed give it a try. It allows you to set the job/worker ratio, which is probably what you want. You could for example say: "If I have more than 30 jobs in the queue, then spin up 5 workers". Then once all the jobs have been processed, it'll spin down all your workers until new jobs are enqueued. I'm also releasing support for Resque workers so in case you use that worker library, you could hook that up too.

0

精彩评论

暂无评论...
验证码 换一张
取 消