May 13, 2014

Grails R14 Error (Memory quota exceeded) on Heroku

I have frequently encountered the following Error R14 (Memory quota exceeded) in the logs while running Grails apps on Heroku on the 1x Dyno which only allows 512mb of RAM:

2014-05-08T04:46:48.294887+00:00 heroku[web.1]: Process running mem=557M(108.9%)
2014-05-08T04:46:48.295268+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

To debug the issue and to be sure I was not having an application specific error, I created a new Grails application and followed the “Getting Started with Grails on Heroku” tutorial, but I still was getting the R14 error with a new application. To debug how much memory was being used, I used the Application Info plugin and ran the new application on Heroku. The source for this application can be found on Github.

I tried to run the same build and server process as Heroku locally but found about a 100mb difference in memory usage. The only difference I had locally was using JDK7. So, I configured the project to use JDK7 on Heroku by add adding a “system.properties” file to the project with the JDK configuration as described in the Heroku Grails tutorial:

#system.properties
java.runtime.version=1.7

After starting up with the new JDK, I no longer say the Error R14 in the logs.

Using JDK7 on Heroku, the Grails application used much less memory on startup (454 vs 582 mb) and under load (496 vs 643 mb) using Apache Bench.

About the Author

Object Partners profile.

One thought on “Grails R14 Error (Memory quota exceeded) on Heroku

  1. jogee says:

    Greaatt!! Thanks man!

  2. Jean says:

    Thanks a lot, man. I had the same problem and was easilly solve by your solution.

  3. Geert Jonker says:

    Thanks, helped me a lot. My 2X Dyno with Grails app went from 1024MB to 624MB.
    Still, my Java Heap is only 364Mb, I’m wondering where all the other Mb’s are going to…

  4. Klemens says:

    In my case, changing from Tomcat to Jetty seemed to help with the memory issue. So the system property looks like this:

    java.runtime.version=1.7
    grails.application.container=jetty

  5. I had to switch to Java 8 (java.runtime.version=1.8) to resolve this problem in my Grails app.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Blog Posts
Performance Test Liquibase Update
When doing a liquibase update to a database if you’re having performance issues, it can be hard to find out which updates are causing problems. If you need to measure the time to apply each […]
TICK Stack Monitoring for the Non-Technical
TICK – Telegraf, Influx, Chronograf, and Kapacitor – is a method of monitoring your systems and applications. In this article, I discuss in non-technical terms what the difference is between TICK and Prometheus Grafana A […]
Design Systems, Part 1 • Introduction
Business leaders need a practical guide to plan and execute Design System Initiatives. The aim of this series is to be that guide. This installment introduces terms and definitions as a primer on Design Systems.
ML for Translating Dysarthria Speech (Pre-Part 1)
What is Dysarthria? Per the Mayo Clinic, Dysarthria occurs when the muscles you use for speech are weak or you have difficulty controlling them. Dysarthria often causes slurred or slow speech that can be difficult […]