Hacker News new | ask | show | jobs
by lloeki 3076 days ago
> Is ruby really such a mess that it's impossible to run an app with reasonable memory consumption?

Yes.

Any non-trivial Ruby app will quickly eat up 500MB, and any non-trivial Rails app will soon balloon to 1GB, with things getting worse over time due to memory fragmentation†. Since there is no parallelism your only option is to either have more unicorn workers, for which prefork and COW are hardly working to save you from duplicating memory, especially over time, or have puma threads and use JRuby, which is a memory hog of its own and often slower than MRI.

There have been arguments made that developer time trumps CPU time [0] but there are some workloads and problem domains and uncontrollable events for which this works at the beginning yet later on you find having yourself painted into a corner as suddenly things are not sustainable because you just can't throw more hardware at the issue without going belly up[1]. Once the low hanging fruits have been reaped you're being challenged just to make your app behave within established parameters with diminishing returns, which I'm sure you'd rather spend on solving actual problems for your customers. At that point you might just as well spend the money on rewriting part or all of your app in a more frugal ecosystem and mindset[2].

† Switching to jemalloc may or may not help. Over here it did not.

[0]: https://m.signalvnoise.com/ruby-has-been-fast-enough-for-13-...

[1]: https://twitter.com/migueldeicaza/status/950054181045440518

[2]: https://twitter.com/lloeki/status/950079609051152384

2 comments

Thanks. I was afraid to hear something like this.

Being a PHP developer myself it's really hard to believe that resource consumption is obviously treaded with so little priority in the rails/ruby world.

And some attitudes here like "who cares? memory/cpu is cheap nowadays" are in my opinion part of the problem. I'd say, well written software should use as little resources as possible. Probably a habit that comes from my early days on a C64 back in the 80s.

> well written software should use as little resources as possible

It's about priorities. IMO if using as little resources as possible is priority number 1, then something is amiss.

Replace "Ruby" with any modern interpreted language and then get over it. With the price of memory so insanely cheap, why does it matter? Gitlab isn't trying to be a lean Go microservice-powered app. It's attempting to be the centre of your source control and deployment world. So 2gb usage seems reasonable to me.

Any cloud provider will provide a VM that can comfortably run it for a very reasonable price.

It’s not just 2GB – I’m running a Gitlab with essentially 2-3 users and activity every few days, and it completely maxes an entire core and uses 6GB RAM constantly.
So what does it do when it uses all that CPU despite the lack of requests coming in? Maybe you have misconfigured some periodic job like backup?
I'm using their official helm chart, it's just idling. Sidekiq is doing nothing, the server is serving no requests - I have no idea how it manages to spend so much time on nothing.
The helm chart is deprecated. Use their omnibus package, it's very stable.
The helm chart "gitlab" is deprecated, the helm chart "gitlab-omnibus" is currently recommended, and the helm chart "cloud native gitlab" is going to be recommended in the near future - a GitLab employee answered me a few hours ago in this thread :)

I'm using the gitlab-omnibus one.