How I solved/fixed the R14 error in heroku.com in a Spree/Rails Application

How I solved/fixed the R14 error in heroku.com in a Spree/Rails Application

This solution is for those cases when you are receiving this error on heroku.com:

heroku[web.1]: Process running mem=533M(104.3%) 
heroku[web.1]: Error R14 (Memory quota exceeded)

Well, you can first try to optimize your app and do some refactor in the section or place where the error R14 is been showed, but why it is appearing this error? Well in my case I’m using only one Dyno for my app that means that my application can use up to 512MB amount of memory and if the app uses more than that amount of memory you are going to see the R14 error but there is a environment variable that you can use and change in order to avoid this error, the variable is called:

WEB_CONCURRENCY

If you want to see what’s the value of this environment variable use the command:

heroku config

I think by default is equal to 2 and that means that your app will try to use 1024MB of memory but if you set 1 as a value you are going to use only 512MB of memory, so based on how many Dynos you are using you have to set this value in my case I just had to run this command, because my app is using 1 dyno as I said previously:

heroku config:set WEB_CONCURRENCY=1

And the error has gone, yaay, thanks for reading.

H.

1 Comment

Post A Comment