3 ms·
Hmm, I'm curious to see how you're reaching the 1GB limit per dyno. How many web workers do you have per dyno? I worked on a pretty heavy monolithic rails app
by gt565k 11y ago
Hmm, I'm curious to see how you're reaching the 1GB limit per dyno. How many web workers do you have per dyno?
I worked on a pretty heavy monolithic rails app that was able to run 3-4 unicorn workers per heroku 512mb dyno.
I'd highly suggest you use newrelic and try to analyze how much memory each worker is consuming and how that exceeds the total dyno 1GB limit. Make sure you look at the peak consumption per worker in new relic. Otherwise you might run into a problem where workers are killed after exceeding the total dyno memory limit. You want to tweak the number of unicorn workers based on their total memory consumption at peak times, and find the optimal number of workers that can fit in a 1GB heroku dyno.
Having said that, heroku does get expensive as you scale up. You'd be better off managing your own servers, but that requires a good chunk of time to setup properly.
A few things I did in order to bring the slug size down for heroku dynos was to move all assets to AWS s3/cloudfront. Minify all CSS and JS, use carrierwave gem to upload to s3 bucket, and serve with cloudfront. Getting all of your static assets out of your slug will greatly reduce memory usage.
Also, I want to point out that you can setup your own database with AWS, and just point it in your env vars for heroku. You don't have to buy all the services from heroku and get charged extra $$.