如何调试ajax请求引发“错误R15(内存配额大大超出)” [英] How to debug an ajax request raising "Error R15 (Memory quota vastly exceeded)"

查看:135
本文介绍了如何调试ajax请求引发“错误R15(内存配额大大超出)”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Heroku上的Rails应用程序与错误R15(内存配额大大超出)崩溃。



我已经将这个问题追踪到包含多个异步请求的页面。这些错误似乎与构建远程数据表的ajax请求一致。



问题是,我找不出为什么会出现这些错误。



我想也许ajaxified数据表背后的数据库查询和控制器动作可能运行缓慢。但是如果我使用miniprofiler在开发中检查这些请求,请求显得非常有效。

然后我想,也许服务器正在接收多个同时发生的请求,而这会使heroku dyno过载。但是,我将雷诺升至极高的数字,但仍然看到了错误。

开始识别和调试导致此内存错误的原因是什么?我以前不必解决这个问题。

解决方案

在Heroku上分配内存是为了增加更多的dynos,如果它是代码级别的话,因为它会导致每个测功机超过它的内存限制单独花费你很多钱,而不是实际解决问题。



你最好是水平缩放,并使用Performance- L dynos。这将增加每个测试仪高达14GB的内存。然后,您可以使用度量标准来查看正在使用多少内存。如果用户内存量耗尽所有14GB,那么您的某个依赖项可能会发生内存泄漏。


I have a Rails app on Heroku that is crashing with Error R15 (Memory quota vastly exceeded).

I've tracked this issue to pages that contain several asynchronous requests. The errors appears to coincide with ajax requests to build remote datatables.

The problem is, I can't figure out why these errors are being raised.

I thought perhaps the databse queries and controller actions behind the ajaxified datatables might be running slowly. But if I examine these in development using miniprofiler, the requests appear very efficent.

Then I thought, perhaps the server is receiving multiple simultaneous requests, and this is overloading the heroku dyno. But I ramped the dynos up to a very high number, and still see the error.

What would be a sensible way to start identfying and debugging what is causing this memory error? I've not had to solve a issue like this before.

解决方案

Memory is allocated per-dyno on Heroku so adding more dynos will probably not actually solve the problem if it is code-level since it will cause each dyno to exceed its memory limit individually costing you lots of money and not actually solving the problem.

You're better off scaling horozontally and using Performance-L dynos. This will increase each dyno up to 14GB of memory. You can then use metrics to see how much memory is being used. If the amount of user memory manages to use up all 14GB then you may have a memory leak in one of your dependencies.

这篇关于如何调试ajax请求引发“错误R15(内存配额大大超出)”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆