Reputation: 49
So I have a Heroku web app running and I have upgraded the number of Dynos I'm using to two in order to handle higher web traffic during our peak hours (We currently have two web dynos and one worker dyno). This morning I was doing some maintenance on the site and ran a very intensive script on one of our webpages (it sends 2,500 address lookup requests to Google's Maps API). After running the script (which runs off of a webpage) I tried loading the homepage and noticed it timed out. I was under the impression that if I had two Dynos running the server would be able to handle two requests simultaneously, but it looks like this may not be the case. Could anyone provide some additional details on how the Heroku Dyno system works?
Upvotes: 0
Views: 351
Reputation: 738
It depends more on what webserver you use... to have that problem, probably you didn't change the webserver and are using Webrick, that comes with Rails and is supposed to work on development environment.
Webrick does not parallel requests... so does not matter how many dynos you have, it just don't use it and handle one request at a time.
To use your dynos, you need a webserver that run on multi-thread like Puma or multi-process like Unicorn.
Today, Heroku recommends run Puma.
Puma handle parallels requests even if running on only one dyno... but obviously more the dynos (and configuring puma to using them) more parallel requests it will handle.
Upvotes: 1