Solution for background jobs on Heroku?

孤街醉人 提交于 2020-02-04 05:04:47

问题


I've used Delayed Job on Heroku's older stacks (Aspen and Bamboo), but with their new(ish) Cedar stack, I'd like to try something more efficient.

The specific background jobs I'm performing are API calls to different carriers (UPS, FedEx, USPS, etc etc) and I typically am processing thousands every hour.

I need to be able to process jobs concurrently to get through the queue quickly.

On top of that, I'd like to try to reduce costs. On the previous stacks where I've been using Delayed Job, I keep having to crank up the Workers, which increases my costs pretty significantly.

So, what's a good background job solution for me on Heroku?


回答1:


The new Cedar stack allows you to use different kind of scheduler and workers, such as Resque. You can find more details about the Procfile and the new stack in the cedar page.

Also note you can easily and automatically scale your workers depending on the load. Here's an example. In this way, you will pay for a worker only when you actually need it.




回答2:


Using Unicorn to run several worker processes on one Dyno can boost concurrency whilst reducing the overall number of workers required. Usually around 3 - 4 unicorn workers per dyno gives the best performance.



来源:https://stackoverflow.com/questions/7407359/solution-for-background-jobs-on-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!