Language Runtime Metrics (Public Beta)
Last updated 21 April 2017
Table of Contents
The language runtime metrics feature allows you to view heap and non-heap memory, as well as garbage collection activity, from Java’s JVM. Language runtime metrics is currently in public beta with support for additional languages planned. Language runtime metrics is available for all Professional dynos (Standard-1X and above) and Private Spaces.
To get started, first add the
heroku-buildpack-metrics buildpack to your app.
Adding the buildpack via the CLI
To add the buildpack using the command line interface (CLI):
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-metrics
Next redeploy your application:
$ git commit --allow-empty -m "Add Heroku Metrics Buildpack" $ git push heroku master
Adding the buildpack via the Dashboard
To add the buildpack using the Dashboard:
From the Settings tab for your app add the buildpack using the full url:
Redeploy your app from the Deploy tab or CLI.
Displaying the JVM metrics plots in Application Metrics
Display of JVM metrics plots can be enabled and disabled using the Metrics Beta Features panel. Individual plots may also be hidden.
Heap and non-heap memory
Language runtime metrics will add new heap and non-heap memory graphs to the Metrics tab on Heroku dashboard. Summary metrics for the selected time interval, including latest, average and maximum memory, are also displayed. Heap memory is where dynamically allocated memory resides. If you see heap memory growing unexpectedly, that’s typically an indication of a memory leak. You can use tools like Heroku Exec for further diagnosis.
Garbage collection activity
In addition to new memory graphs, language runtime metrics will add a garbage collection activity chart. The chart displays the amount of time that was spent doing garbage collection for each time increment. High garbage collection activity typically has a negative impact on response time. It may also suggest that your app needs more memory.
Language runtime metrics collects data from the JVM running on your dyno. The overall impact of JVM metrics collection on application performance is minimal. In our testing we observed the following:
- an estimated 1MB of additional peak heap usage
- ~300 additional classes loaded, resulting in < 1MB of additional Metaspace (off-heap) memory
- 9 additional threads (3 running, 5 parked, 1 waiting)
For deployment with the Heroku Maven plugin, you must set the following plugin configuration in your
<configuration> <buildpacks> <buildpack>jvm-common</buildpack> <buildpack>https://github.com/heroku/heroku-buildpack-metrics</buildpack> </buildpacks> <configuration>
For sbt-heroku, add the following code to your
herokuBuildpacks in Compile := Seq( "jvm-common", "https://github.com/heroku/heroku-buildpack-metrics" )
Using with JRuby
To use this feature with JRuby, you must include the
heroku/jvm buildpack with your app by running:
$ heroku buildpacks:add -i 1 heroku/jvm
Then redeploy your application.
The language metrics feature is not compatible with WAR file deployment from the CLI. Language metrics are also not supported for Clojure at this time.
Disabling metrics collection
To disable JVM metrics collection remove the buildpack and redeploy your app:
$ heroku buildpacks:remove https://github.com/heroku/heroku-buildpack-metrics $ git commit --allow-empty -m "Remove Heroku Metrics Buildpack" $ git push heroku master