1
votes

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.

2

2 Answers

1
votes

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.

0
votes

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

Memory Usage Graph