简体   繁体   English

Django + Heroku:内存不足问题

[英]Django + Heroku: Out of Memory problems

So this is my first time deploying a django instance on Heroku.所以这是我第一次在 Heroku 上部署 django 实例。 My site has had 1000 visits so far and 600 unique visits.到目前为止,我的网站已经有 1000 次访问和 600 次独立访问。 We get about 60-200 visits per day.我们每天大约有 60-200 次访问。 The link is https://socialspark.spuro.org/链接是https://socialspark.spuro.org/

Today, 6 days into being live - our site is running into a lot of memory issues.今天,上线 6 天了 - 我们的网站遇到了很多内存问题。 IE, cannot allocate dyno process or, cannot allocate memory: IE,无法分配动态进程或无法分配内存:

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?这真的是因为 Django 获得了这些信息吗? 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我什至将我们的流程更新为 2X(并因此付费),但我仍然遇到

could not fork new process for connection: Cannot allocate memory

This turned out to be an error on Heroku's part for their starter DBs.事实证明,这是 Heroku 对其入门数据库的错误。

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.对于其他经历过这种情况的人,请注意 Stack Overflow 上的类似线程 - 这也确认这可能是 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.你可以为自己节省几个小时。

重新启动服务器对我有帮助(打开和关闭维护模式)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM