Reputation: 4516
I'm running ruby/rails on heroku, and I want to scale my workers..
Heroku has this great api to scale the workers..
heroku.post_ps_scale(APP_NAME, 'worker', count)
#brings up new worker dyno's, or scales down
The problem is the workers are not aware of queues... If I have two clients and each get their own queues in delayed job. Then their tasks clash with each other.
To get workers working on different queues, but they are on the same dyno as the app that started them (aka the web dyno)
cmd = "rake jobs:work WORKER=STYLE_SERF QUEUES=#{queue}"
Rush::Box.new[Rails.root].bash( cmd, :background => true )
Question
How do I create worker dyno's that are queue aware?
I expect it would be some combination of the code above.
EDIT:
Some have suggested that I make use of the procFile, the problem I face is that I don't know the number or worker queues that I'm going to need.
It is excellent for setting up "urgent" or "due_yesterday" workers who work off specific queues... but I want to have a queue per client.
So worker_1 works on client_1 jobs and worker_2 works on client_2 jobs. Never crossing to the other.
It's easy to imagine client_1 doing product updates every hour and client_2 doing them once a week.
EXTENDED QUESTION (based on edit) Can one adjust the procfile at run time? Is it a file, or is it compiled into the code? If it's an accessible file, then perhaps I could "create" worker types.
Upvotes: 0
Views: 583
Reputation: 911
You could try http://hirefire.io/ it's 10usd per month , you get 30 days to try it but scale both workers and dynos amazingly according to your queue size and response time and it s customizable !
Upvotes: 1