Email notifications about crashing due to insufficient memory, but I've already scaled

Hi! I have a Rails app with a web process and a worker process, both scaled to 1GB of RAM but I am still receiving email notifications speaking of crashes due to insufficient memory, recommending that I scale to 1GB. But I’ve done that already.

The log lines attached to the emails look like this:

Out of memory: Killed process 744 (ruby) total-vm:564996kB, anon-rss:436092kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:1116kB oom_score_adj:0

How is it possible? It seems that it crashes above half GB but I have scaled to 1GB.

Any suggestions? Thanks

The easiest fix is to add more memory. You are not limited to 1GB. See: Scaling and Autoscaling · Fly Docs

The next easiest fix is to add a swapfile. You haven’t mentioned if you are using Dockerfiles, but Rails applications deployed using Dockerfiles on automatically enable swapping. If you have a second process defined at that process is the one running out of memory, you would need to define a swapfile there too.

Those are the available options without modifying your application.

Hi, thanks for your reply. The thing is that this web app with 2 puma process has never used more than 300MB per process, so the 1GB it has now should be plenty. If you see the load line I pasted in the original post, you can see that the memory was exhausted when usage went above 512MB, as if it never scaled to 1GB. However when I check the status of the app both with the CLI and the Web control panel, it shows 1GB for the web process and 1GB for the worker process. That’s what I don’t understand.