Running delayed jobs on Heroku for free

后端 未结 5 479
执念已碎
执念已碎 2021-02-02 13:02

Is it possible to run delayed jobs on Heroku for free?

I\'m trying to use delayed_job_active_record on Heroku. However, it requires a

相关标签:
5条回答
  • 2021-02-02 13:25

    Splitting the process like that can incur problems - your best bet is it not try and get it 'free' but use something like http://hirefireapp.com/ which will start up a worker when there are jobs to perform reducing the cost significantly rather than running a worker 24x7.

    Also note, Heroku will only ever autostart a 'web' process for you, starting other named processes is a manual task.

    0 讨论(0)
  • 2021-02-02 13:28

    Ideally there is no straight way to get this free, but you would find lots of workaround one can make to enjoy free background jobs. One of which is http://nofail.de/2011/07/heroku-cedar-background-jobs-for-free/

    Also if you plan to use resque which is an excellent choice for background jobs you would need redis which comes free with nano version => https://addons.heroku.com/redistogo. https://devcenter.heroku.com/articles/queuing-ruby-resque

    Simple solution is to buy a one dyno for the worker, whereas your web dyno would be free.

    Let me if you need more help.

    Thanks

    0 讨论(0)
  • 2021-02-02 13:42

    If you only have one web worker, Heroku will sleep it if it's inactive for an hour.

    Also, Heroku will reboot all dynos at least once a day.

    This makes it hard to do a within-ruby scheduler. It has to at least use persistent storage (e.g. database).

    0 讨论(0)
  • 2021-02-02 13:44

    Consider using the Workless gem: https://github.com/lostboy/workless

    0 讨论(0)
  • 2021-02-02 13:46

    You can use Heroku Scheduler to run the jobs using the command

    rake jobs:workoff
    

    This way the jobs can run in your web dyno. According to Delayed_Job docs, this command will run all available jobs and exit.

    You can configure the scheduler to run this command every 10 minutes for example, and it doesn't have sensible effect on the app's performance when no jobs are queued. Another good idea is to schedule it to run daily at a time with lower access rates.

    0 讨论(0)
提交回复
热议问题