Sidekiq on heroku - Error R14 (Memory quota exceeded)

时光怂恿深爱的人放手 提交于 2019-12-11 10:55:24

问题


I have a sidekiq process which runs on heroku that blows up after it has been running for a while with this error message:

Error R14 (Memory quota exceeded)

Can anyone give me any pointers about how to start the diagnosis as to what is happening?

There is nothing obvious that could be causing this.


回答1:


We are facing the same problem and have decided to let Newrelic do the heavy lifting and help us with the diagnostic. There are some free Newrelic plans you might be able to use for that, but if none of them go deep enough into your code, you might want to consider paying for the Pro version for one month to help you profile your app.

I can't help you any further with this because we are about to switch to Pro (waiting for Newrelic to accept the plan) so don't have any more insight, but thought it might help you to look at it.

If you don't want to use Newrelic, Heroku also has a lab feature that will profile memory usage and report to the logs, enable it with:

heroku labs:enable log-runtime-metrics

Then it will show you how much memory each of your dynos is using.

The error you're getting is when the memory on Heroku exceeds the memory quota. Heroku has this to say about it:

Dynos whose processes exceed their memory quota are identified by an R14 error in the logs. This doesn’t terminate the process, but it does warn of deteriorating application conditions: memory used above quota will swap out to disk, which substantially degrades dyno performance.

This page has more info.




回答2:


Try lowering concurrency. Sidekiq default is 25. I lowered it to 15, and it drastically reduced memory usage and removed memory swap error.



来源:https://stackoverflow.com/questions/19019589/sidekiq-on-heroku-error-r14-memory-quota-exceeded

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