Django app on 256mb?

Hi, I moved a small django 3.2 hobby app from Heroku free tier to here, but I can’t seem to make it work fully under the free offering. The problem is that when I do a “login” the memory used spike to 300Mb, so it crash. Scaling the vm to 512mb fix this, but since the login is the only feature that seems to require more then 256mb.(If I scale back the VM to 256mb after the login, all works fine) it’s mostly a big waste of ressource.

Anyone met this problem and knows how to maybe limit django memory usage?
Not sure why it spike memory usage for a simple login. I use the built-in django-auth for login.

1 Like

Rails has similar issues. You can get further if you define a swapfile. The basic approach is to replace the ENTRYPOINT/CMD in your dockerfile with a command to run an initialization script. That script needs to create a swapfile and then run your application.

You can see the commands that the fly.io launch scanner produces for Rails apps here:

2 Likes

Adding a swap worked! :slight_smile: I scaled back to 256mb and it doesn’t crash anymore, thanks!

1 Like

FR (:

1 Like