Search code examples
ruby-on-railsherokudelayed-job

Delayed Job on Heroku


I have a Rails application hosted on Heroku that requires a weekly data import. The task is performed by administrators and takes about 1-2 minutes to run (compute time). On Heroku, jobs that require more than 30 seconds time out. Heroku recommends job queues - however paying $36.00 per month (price of one worker) for 8 minutes of compute time doesn't seem appropriate. A few questions:

  1. Is it possible to only pay for delayed jobs when they are used (i.e. launch the delayed job service only when administrators are uploading the data import).
  2. Is delayed job required? I'm not sure if the timeout is just displayed to the client or if the actual work is cancelled. The documentation does list 'take no action' as an option, but I'm not sure what the implications of this are.

Thanks!


Solution

  • You might check out HireFire.

    HireFire automatically "hires" and "fires" (aka "scales") Delayed Job and Resque workers on Heroku. When there are no queue jobs, HireFire will fire (shut down) all workers. If there are queued jobs, then it'll hire (spin up) workers. The amount of workers that get hired depends on the amount of queued jobs (the ratio can be configured by you).