How do I handle long requests for a Rails App so other users are not delayed too much?

久未见 提交于 2019-12-02 10:14:56

That sounds like a Delayed Job situation. If the first request is just waiting, the most efficient thing to do is assign a process to wait for it to complete and cut the Rails process loose to handle another request.

Yes you need more dynos, speccialy worker dynos those are the ones that work on the background you can check this railscast on delayed jobs that can help also:

http://railscasts.com/episodes/366-sidekiq

also here is a quick tutorial on adding unicorn and multiple threads to your free heroku instance:

https://devcenter.heroku.com/articles/rails-unicorn

you divide your dyno into two or more instances then each one can handle a different request

What kind of app server are you using? If you are using passenger or unicorn, you can have multiple worker processes that can handle simultaneous requests

http://www.modrails.com/documentation/Users%20guide%20Apache.html#_passengermaxinstancesperapp_lt_integer_gt

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