Should I use thin or unicorn on Heroku Cedar

假如想象 提交于 2019-12-20 08:24:36

问题


I recently 'upgraded' my app to the cedar platform on Heroku. By default, I am using thin as a web server. But I have always been tempted to use unicorn for concurrency and having my dyno dollar go father. But I worry there are some gotchas in using something other than Thin.

Does anyone have real-life experience with this decision?


Notes:

  • This was the article that got me excited about the idea: http://michaelvanrooijen.com/articles/2011/06/01-more-concurrency-on-a-single-heroku-dyno-with-the-new-celadon-cedar-stack/
  • I know every app is different, and that you should build a staging env and try it for yourself. But if it looks great in your staging env, are they any pitfalls that we should know about?

I want to know reasons why everyone shouldn't do this


回答1:


Update -- 3 months later.

I have been using unicorn in production for 3 months, and I have been very pleased. I use 4 unicorn workers per dyno.

One thing you do need to keep an eye out for is memory consumption and leakage. In effect instead of having 512MB of memory per dyno -- you have that divided by the number of heroku workers. But keeping that in mind -- it has been a great cost saver




回答2:


No reason not to do it - I use Unicorn on Heroku with much success.




回答3:


Heroku has just written a post about using Unicorn : https://blog.heroku.com/archives/2013/2/27/unicorn_rails

I'll try it now, it seems like it's the way to go, both for performance and cost saving.




回答4:


If you use Thin, and your code doesn't clear requests very quickly, then you're in trouble - since Heroku uses random routing, requests will stack up on a blocked dyno even if there are free dynos. Using Unicorn seems better, if you can handle the memory hit, because it's less likely that all of your forks will get slow requests at the same time. It doesn't solve Heroku's random-routing problem, but it should help a lot.

Links and explanations in this answer:

https://stackoverflow.com/a/19965981/1233555



来源:https://stackoverflow.com/questions/9792290/should-i-use-thin-or-unicorn-on-heroku-cedar

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