Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the tradeoff between using larger dynos vs more dynos on Heroku

On a our Heroku Rails 4.2 web app running Unicorn workers, where each worker needs about 230MB, we can run 2 per '1X' Heroku dyno, or 4 per '2X' Heroku dyno. CPU requirements are quite low.

If we need 8 workers to handle our traffic, what are the technical / performance tradeoffs of using four '1X' dynos vs. two '2X' dynos to get 8 workers?

(Two years ago there was a well-publicized issue with the way Heroku was routing to dynos that as I recall suggested larger dynos with more workers worked best because there was less chance of a request being routed to a 'busy' dyno. But I'm not finding any current guidelines on when it is best to use larger dynos vs more dynos.)

like image 877
jpw Avatar asked Nov 10 '22 04:11

jpw


1 Answers

As far as I know as you already mentioned Heroku routers don't know and care about load in a specific dyno and sends the request by a random selection algorithm. https://devcenter.heroku.com/articles/http-routing

So it is very likely to see many consecutive requests going to same dyno. I am observing that behaviour with my current applications.

But in your case if a worker need 230MB then you can't use 2 worker in a Standard-1X dyno because their max memory is 512M. So I think you should definitely go for 2X dynos with like 3-4 workers. 2X dynos can use up to 1GB memory.

like image 58
cool Avatar answered Nov 15 '22 05:11

cool