错误R14(超出内存配额)在新REI中不可见

2024-05-16 14:56:22 发布

您现在位置:Python中文网/ 问答频道 /正文

在Heroku上继续收到错误R14(超出内存配额)。在

在本地评测django应用程序的内存时,我没有发现任何问题。除了一件很奇怪的东西,我们在那里安装了新的东西:

http://screencast.com/t/Uv1W3bjd

内存使用量在每个dyno上徘徊在15mb左右,但由于某些原因,“dynos running”很快就扩展到了10+。不知道这有什么意义,因为我们目前只运行网络动态。在

我们也经营芹菜,看起来也很正常(大约15mb)。虽然它是可疑的,因为我相信我们开始有错误时,这个发射。在

我们的一些请求确实需要一段时间,就像它们向echosign发出soap请求一样,有时需要6-10秒来响应。这是不是在某种程度上阻碍了新的动力系统的运转?在

这是我的程序文件:

web: python manage.py collectstatic --noinput; python manage.py compress; newrelic-admin run-program python manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 9 -k gevent --max-requests 250
celeryd: newrelic-admin run-program python manage.py celeryd -E -B --loglevel=INFO

但主要问题是内存错误。在


Tags: django内存runpy应用程序httpherokumanage
1条回答
网友
1楼 · 发布于 2024-05-16 14:56:22

我想我可能找到了问题所在。在

基于poststhese我认为我应该有9-10个冈尼科恩工人的区域。我认为这是不正确的(或者至少,这是我的应用程序正在做的工作)。在

我已经运行了9个gunicorn工人,最后意识到这是heroku和local之间唯一的区别(就配置而言)。在

根据gunicorn design document对工人的建议是这样的:

DO NOT scale the number of workers to the number of clients you expect to have. Gunicorn should only need 4-12 worker processes to handle hundreds or thousands of requests per second.

Gunicorn relies on the operating system to provide all of the load balancing when handling requests. Generally we recommend (2 x $num_cores) + 1 as the number of workers to start off with. While not overly scientific, the formula is based on the assumption that for a given core, one worker will be reading or writing from the socket while the other worker is processing a request.

虽然有关于Heroku Dyno CPU能力的信息,但我现在读到每个Dyno都在大约1/4的核心上运行。不是超级强大,但我想已经足够强大了。在

把我的员工调低到3(根据他们粗略的公式,这个数字甚至很高)似乎已经阻止了我的记忆问题,至少现在是这样。当我想起来的时候,我得到的关于记忆警告的有趣的事情是它永远不会上升。它上升到103%左右,然后一直保持在那里,而如果它真的是泄漏,它应该一直上升直到被关闭。所以我的理论是我的工作人员最终消耗的内存刚好能超过512mb。在

HEROKU应该在某处添加此信息!!而且至少我应该能够top进入我的运行动态,看看发生了什么。会为我节省很多时间和时间。在

相关问题 更多 >