So I was wondering, Heroku can run multiple dynos to handle a growing number of requests. This scalability is one of the greatest value propositions.
Is it possible to something similar locally? Essentially, I am developing an app and it runs a lot of requests and calculations that I am testing out. For the time being, much of the calculation is run by the rails server, so a request to load a page with sorted material can take a minute or more. Eventually I am going to move these calculations to the background using delayed_job, but I’m still developing my algorithm so I am not trying to make that change yet.
SO what I am wondering is, can I run multiple rails servers so that on one I can click around the website and on the other run these calculations? I tried opening two on different ports, but they don’t run well concurrently (to the point of almost not running at all).
Any advice is greatly appreciated!
My advice is to start using the background job method now. All you’ll be doing is having the same code running… in the background. You should be able to do it in 5 minutes. Right now you’re probably spending a lot of time on other solutions that can be spent on the code. Once you start using delayedJob, bachgrouddrb or another option you won’t look back.
There is a good post here that may help you:
http://www.tobinharris.com/past/2009/3/9/6-ways-to-run-background-jobs-in-rubyonrails/ and also
Ruby on Rails: How to run things in the background?