4 ms·
> What is consumes so much RAM and why? That's just a complex rails application for you, at $DAYJOB we have to provision 11gb for just a single container runni
by imran-iq 4y ago
> What is consumes so much RAM and why?
That's just a complex rails application for you, at $DAYJOB we have to provision 11gb for just a single container running a single instance of the app
- danielheath 4y agoI’m running a high traffic rails app with 15 years of source history; our instances have no trouble at 4gb for both unicorn (8 processes) and sidekiq (5 processes). Except for image processing, which uses a ton of ram and readily OOMs.
- imran-iq 4y agoI've worked at two very large rails shops (think >10 billion dollar companies) both of which have had stupidly high ram requirements for their code without any image processing. Gitlab which also happens to be another billion dollar rails shop, also requires a stupid amount of ram as per the parent comment. I wonder what the common thread is...
- onion2k 4y agoYou seem to be suggesting Rails memory usage scales with market cap, which would be incredible if true. "Why does the app keep crashing?" "Because the share price went up again!"
- chucke 4y agoIt definitely correlates. Ruby is not the culprit though. It uses and abuses memory as fairly as other similarly GC backed dynamic languages. The issue may be rails and the monolithic pattern, which favours rapid feature development and postpones optimization for when necessary, or one can no longer realise that snippet you wrote 2y ago fetching data from the db scales well for 5 objects, but not 500 objects, but you forgot about that already. Ruby has a generational GC which already supports compaction, but not in a production ready continuous way, which means most usages have it turned off, and memory pages tend to overcoming and stay fragmented for long running processes. Python has the same issue and node AFAIK.
- mekster 4y agoIt's apparent that a bigger company has more money to throw at the performance problem if that can solve it. Smaller companies want better optimization of their spending with better coding standards.
- ascar 4y agoIt has been a few years since, but I wrote a standalone small Rails app for an internal service for a company that also runs a giant Rails app for their main business. I ended up heavily tuning the ruby GC parameters, which reduced the final resource usage of the app especially over longer continued use nearly tenfold. There is a lot to gain if you know the actual object and memory limits your app needs for it's core usage rather than letting Ruby allocate more and more memory. Caveat is that was a long time ago with Ruby ~2.3 and things have certainly changed and probably improved by now. That service has been as stable as one could hope. It just runs in a docker container on a dedicated machine that's also used for other development purposes and consumes a couple of hundred MB of ram. The number of times it was down in the past ~6 years can be counted on one hand.
- mekster 4y agoPlease stop blaming rails... It's the developer who just doesn't know how things work under the hood and code as they like and memory usage explodes.