GCC App Engine标准环境中Django的内存使用失败

huangapple go评论65阅读模式
英文:

GCC App Engine standard enviroment in Django memory usage fails

问题

I am experiencing a memory problem in my Django app, which has been ongoing for the past month. My app is hosted on GAE with SQL PostgreSQL DB. It seems that I haven't made any relevant changes in terms of memory consumption, yet I'm encountering this error randomly during requests.

The error message I'm encountering is as follows:

"While handling this request, the process that handled this request was found to be using too much memory and was terminated. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you may have a memory leak in your application or may be using an instance with insufficient memory. Consider setting a larger instance class in app.yaml."

I'm trying to identify the source of this error. Increasing the minimum instance type has reduced the number of errors, but they still occur. I don't believe my app should require a significant amount of memory.

Could anyone assist me in resolving this issue? What steps can I take?

Thanks,
Pablo

英文:

From 1 month ago I am experiencing a memory problem in my django app. It is in GCC in GAE + SQL Postgress DB. Apparently I did not modify anything relevant from a memory consumption point of view, getting the error randomly all along the requests.

The error I got is this:

While handling this request, the process that handled this request was found to be using too much memory and was terminated. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you may have a memory leak in your application or may be using an instance with insufficient memory. Consider setting a larger instance class in app.yaml.

I am wondering how can I identify the source of this error. Increasing instante minimum type of course decreased the number of errors but they are still present. I do not think my app needs a lot of memory anyway.

Can anybody help me? What can I do?

Thanks,

Pablo

答案1

得分: 1

根据错误消息,处理此请求的进程使用了过多的内存并被终止。这可能会导致下一个请求使用新的进程来处理。如果您经常看到此消息,可能是应用程序中存在内存泄漏,或者使用的实例内存不足。考虑在app.yaml中设置一个更大的实例类别。

看起来请求正在使用过多的内存,导致内存不足。

为了缓解此问题,我建议检查以下选项:

  1. 使用更大的实例类别或根据应用程序工作负载升级具有更多内存的实例类别,这可能有助于解决此问题。
  2. 确保应用程序捕获SIGTERM信号。如果没有捕获,实例将立即关闭。这在公共文档中有说明。
  3. 减少每个请求处理的数据块。您可以将其拆分成较小的部分,让较小的实例来处理工作。
  4. 还可以查看这个Stackoverflow链接,因为您正在尝试在App Engine Standard中配置资源设置。资源部分仅在App Engine Flexible中可配置。建议在app.yaml中添加env: flex以使其生效。

可能是代码发生了变化导致错误,尝试按照评论部分的@NocommandLine提供的步骤来调试问题。如果上述步骤没有帮助,您可以考虑联系Google支持,因为可能需要进行项目检查。

英文:

As per the error message,

>While handling this request, the process that handled this request was found to be using too much memory and was terminated. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you may have a memory leak in your application or may be using an instance with insufficient memory. Consider setting a larger instance class in app.yaml.

It seems like the requests are utilizing too much memory which causes the insufficient memory.

To mitigate this issue, I would suggest to cross check the below options:

  1. Use a larger instance class or upgrade an instance class with more memory based on your application workload, which may help you to resolve this issue.
  2. Also make sure the app is catching the SIGTERM signal. If not, the instance is immediately shut down. This was stated in the public Documentation.
  3. To reduce the chunks of data you process in each request. You could split it to smaller pieces and keep the smaller instance doing the work.
  4. Also have a look at this Stackoverflow Link, as you are trying to configure resource settings in App Engine Standard. The resources section is only configurable in App Engine Flexible. It is suggested adding env: flex in the app.yaml for it to take into effect.

There might be the possibility the error occurs due to a change in the code and try to debug the issue by following the steps provided by @NocommandLine in the Comment section. If the above steps don't help, you may consider contacting Google support as it may require project inspection.

huangapple
  • 本文由 发表于 2023年5月30日 06:26:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76360634.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定