Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine better ram default #68

Closed
freeformz opened this issue Mar 22, 2019 · 5 comments
Closed

Determine better ram default #68

freeformz opened this issue Mar 22, 2019 · 5 comments

Comments

@freeformz
Copy link

freeformz commented Mar 22, 2019

FWIW, you can determine the amount of available RAM in MB in a Heroku Dyno (or probably any container that uses cgroups in which that cgroup data is exposed in the container) with:

Integer(Integer(IO.read("/sys/fs/cgroup/memory/memory.limit_in_bytes")) / 1024 / 1024)

The current amount of memory being used by all processes in a dyno can be found in /sys/fs/cgroup/memory/memory.usage_in_bytes. This is only currently exposed in private space dynos though.

@schneems
Copy link
Member

oh, that’s useful. Previously I’ve had to map “ulimit” results to different dyno types. This seems better.

@schneems schneems reopened this Nov 5, 2019
@oyeanuj
Copy link

oyeanuj commented Jan 27, 2020

@schneems Just checking if this is on your radar to incorporate in this library? Thank you for creating this library!

@schneems
Copy link
Member

@oyeanuj want to send me a PR?

@oyeanuj
Copy link

oyeanuj commented Jan 30, 2020

Unfortunately, I don't understand Heroku spaces or puma much to be able to PR this. Maybe @freeformz can?

@schneems
Copy link
Member

On a standard-1 dyno:

~ $ cat /sys/fs/cgroup/memory/memory.limit_in_bytes
536870912

and 536870912 / 1024 /1024 => 512 so it looks like this is right. I still want to make this the default, but also don't know when i'll have time to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants