How to debug an ajax request raising “Error R15 (Memory quota vastly exceeded)”

浪尽此生 提交于 2019-12-11 05:09:34

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/42785631/how-to-debug-an-ajax-request-raising-error-r15-memory-quota-vastly-exceeded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!