Skip to content
Advertisement

Django + Heroku: Out of Memory problems

So this is my first time deploying a django instance on Heroku. My site has had 1000 visits so far and 600 unique visits. We get about 60-200 visits per day. The link is https://socialspark.spuro.org/

Today, 6 days into being live – our site is running into a lot of memory issues. I.E., cannot allocate dyno process or, cannot allocate memory:

OperationalError at /
FATAL:  out of memory
DETAIL:  Failed on request of size 33208.
could not fork new process for connection: Cannot allocate memory

FATAL:  out of memory

Can anyone explain why this is happening? Is this really because Django get scale this information? Am I doing something wrong in my code? It’s really difficult to diagnose.

I’ve even updated our process to 2X (and thus paying) but I’m still encountering

could not fork new process for connection: Cannot allocate memory

Advertisement

Answer

This turned out to be an error on Heroku’s part for their starter DBs.

For others that experience this, look out for similar threads on Stack Overflow – which had also affirmed that this may have been an issue with Heroku. In debugging this, I was instead encouraged to review DB optimization, among other things. Following this, I optimized all of my queries and I still ran into this error.

Just look out for similar threads like this one, send a ticket and then examine your own code. You could save yourself a few hours.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement