Paid plan doesn't provide enough memory to run a Rails console

Hi all,

I was recently dissappointed to discover, after upgrading to Starter plan specifically to access the Shell, that a rails console would not run due to hitting the 512mb memory limit.

So far I have only deployed a fresh rails app, which is completely empty and doing nothing other than it’s defaults. So I was surprised to find out that I’m already maxing out memory. To use a rails console, I would have to upgrade further ($25) which I can’t justify.

Am I just unlucky here? Or is this just some sneaky move to make you bump your plan up? They should really make it clear that a Rails console won’t work unless you have a Basic plan because that seems the reality of it.

Hi Matt,

Absolutely nothing sneaky here at all - I’ve been deploying countless Rails apps to the platform myself and will always use the starter instance type and never had any issue at all accessing console and I’ve not seen similar reports like this, ever.

I’d like to understand more here - are you simply deploying results of rails new here? What version of Rails/Ruby etc.

Regards,

John B
Render Support, UTC+1 :uk:

Hi John. Interesting, well it makes me feel better that it’s not the norm at least. Wierdly, on the support ticket (45710) I was just told to upgrade, and they didn’t offer to investigate the high memory at all, so thanks for your interest in fixing this at least.

Pretty much, rails new, and I added one basic Model to the app, and connected it to an empty postgres (maybe thats the issue?)

Ruby 3.2.2 with Rails 7.1, Postgres14

I can see that ticket, and we diagnosed the error that was being presented, i.e., the killed message. Memory usage is on the application side so it’s slightly out of our remit. Using tools like New Relic APM inside your application can help you understand where the memory is being used - at the platform level all we see is the memory being used.

But, I wanted to double-check Rails 7.1 behavior as it dropped relatively recently. So I made GitHub - johnbeynonorg/rail71demo - a vanilla Rails 7.1 app, with a single model (Post) and a Postgres DB, out of the box it’s booted up using 496Mb so there’s not much room there in a 512Mb starter instance for sure.

I took a look at the default puma.rb that Rails 7.1 ships with:

# Specifies that the worker count should equal the number of processors in production.
if ENV["RAILS_ENV"] == "production"
  require "concurrent-ruby"
  worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
  workers worker_count if worker_count > 1
end

so that’s setting the web concurrency here based on the physical processor count, which will be incorrect when you’re running on a Cloud platform - you don’t have 16 cpus! (As ``Concurrent.physical_processor_count` returns)

Setting WEB_CONCURRENCY to a much smaller number, eg 2 then you see this:

which will leave you plenty of headroom as it’s now using less that

I hope that’s useful here,

Regards,

John B
Render Support, UTC+1 :uk:

2 Likes

Wow, a phenomenal response!

Thanks so much for figuring this out for me and so quickly, you’ve almost made me feel… lazy!

This did indeed work and I have now reinstated my paid plan. Give this man a pay rise ^ :slight_smile:

1 Like

You’re very welcome, happy to have helped.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.