4 ms·
If you are using the NewRelic add-on you can go to the "dynos" tab and see the memory footprint of your application over time. The Heroku memory cap is 512mb,
by malyk 14y ago
If you are using the NewRelic add-on you can go to the "dynos" tab and see the memory footprint of your application over time. The Heroku memory cap is 512mb, so if you stay a decent amount of space clear of that then you are likely to be ok running multiple workers per dyno.
For instance, our app which I'd say is a medium sized rails app, generally consumes between 175mb and 210mb of memory. So we /should/ be safe running 2 workers per dyno which would effectively double our processing power.
HOWEVER, if you hover over the memory graph it'll tell you the min/max/avg consumption over that particular time period. Looking at that I see we sometimes spike the max over 350mb. The question is, what is that spike going to look like running unicorn. Unfortunately, I can't think of many ways to accurately test/predict that without simply giving it a try.
One other thing that was mentioned in the comments of the article is that you can set the unicorn backlog to a very low number (default appears to be 1024) which will apparently tell the heroku router that a particular dyno is "full" and to look somewhere else to process the request. One comment recommends setting the backlog to 25. I wonder what setting the backlog to something like #workers*2 would do.