Why are my New Relic memory graphs different From Heroku?

Issue

When you look at your New Relic memory consumption graphs, it shows less memory use than your Heroku memory metrics.

Resolution

NewRelic and other monitors may not be capturing metrics for all the process being run in your application.

Our charts take into consideration all memory use in the dyno, as seen by the operating system through the dyno's statistics. These values are read every 20s and reported to us. We then do our computations (really just sum, min, max, sum of squares, count) grouped by process type (i.e. all the web metrics together and all the worker metrics together) and return the appropriate data for the charts.

New Relic is not taking into consideration other processes that are running in the lxc container. You can see this for yourself by running:

$ heroku run bash
heroku $ top -n 1
...

bash isn't the only process that is running. At the very least you'll see ps-run, which also takes a small amount of memory. New Relic won't take this into consideration because it's not asking the operating system how much memory is being used (as in the case of Heroku metrics), it's asking the JVM/RubyVM/etc.

Additionally, there's a known discrepancy between the memory stats that lxc containers provide within the container and what is observed outside of the container.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support