pratski
pratski

Reputation: 1478

Do I need a worker dyno on Heroku?

I have not specifically added any background tasks to my Rails app. The app is going to be sending emails and also going to be resizing images. But I haven't included any background processes like delayed_jobs or Resque in my app. And for the time being I am not going to be adding background processes. So do I need a worker dyno?

If I add a worker dyno, would these tasks be automatically handled by the worker dyno?

Upvotes: 0

Views: 177

Answers (2)

Mike Szyndel
Mike Szyndel

Reputation: 10593

Nothing happens by magic! Unless you add delayed_job or other gem for handling tasks in background and explicitly write code that should be performed in background - it will not.

When it comes to sending email and resizing images - it's encouraged to use background workers for those tasks but it's not a must. As long as you don't see timeouts for requests you should be all ok.

If you decide upon using delayed_job in the future take a look at workless gem - it autoscales worker dyno when it's needed and then scales it back to zero. I use it in my projects and that saves my quite some money.

Upvotes: 1

Tobi
Tobi

Reputation: 27

If you are not running background processes you should be fine without a worker dyno.

But it depends also on your normal processes. If your processes are having to long of a request time (e.g. might be the case with your image resizing) it might be useful to pack that into a background task.

Pretty good explanation of this can be found on the Heroku website:

https://devcenter.heroku.com/articles/background-jobs-queueing

Of course the beauty of Heroku is it's scalability... so if you see that your tasks are having to high response times you can always add a worker dyno later and then change the task into a background task.

Upvotes: 1

Related Questions