Hacker News new | ask | show | jobs
by thraxil 4853 days ago
"Yes, one solution is to run a concurrent web server like Unicorn, but this is very difficult on Heroku since concurrent servers use more memory and Heroku’s dynos only have 512mb of ram, which is low for even processing one request simultaneously."

Is this really accurate? 512mb is barely adequate for serving a single request at a time? I'm not a Rails developer, but that sounds terrible. I'm all for trading off some performance for rapid development, but that seems a bit extreme.

I'm currently running twelve Django apps on one 512MB Rackspace VM. It's a bit tight, and I don't get a lot of traffic on them, but it's basically fine. And that's with Apache worker mpm + mod_wsgi (with an Nginx reverse proxy in front) which probably isn't even the lightest approach. And having been writing apps in Erlang and Go recently, I'm starting to feel like Python/Django are unforgivably bloated in comparison.

3 comments

It really depends on your application. A fresh rails app will take up ~30mb of memory (iirc, been a while since I checked). Thirty gems and 11,000 lines of code later, yes, it can spike to 256mb.

If I were to toss down an average, seems like ~100mb is what I see most of the time for non-trivial rails apps.

The main Rails app that I work in is a medium sized app and runs at 220mb memory usage on a dyno on averae. It spikes to the 350mb range occasionally probably from image generation with rmagick or PDF generation.
OK. That sounds reasonable and pretty comparable to what I expect to see from a full-stack framework.
I have many apps on Heroku, all running Rails, and mostly running on Unicorn, with three or four workers. Most of the apps I've seen pass me by use no more than 150Mb per worker, and there's a fair amount of work going on in many of them with image processing and the like.

512Mb for a single application sounds incredibly high to me.

EDIT: After looking at the docs, it seems like 512Mb isn't even a hard limit: https://devcenter.heroku.com/articles/dynos#memory-behavior

Atwood's new Discourse thingy recommends 1GB of RAM:

    We also recommend a minimum 1 Gb RAM to host Discourse,
    though it may work with slightly less.
~ http://www.discourse.org/faq/

Guess it depends.

Note that that's their recommendation for a single VPS that includes the postgres & redis servers on it as well, not just the Rails stack.