R14 hero error with java Play 1 application runs on OpenJDK 1.8

I recently updated the Play v1 app to use OpenJDK v1.8 on Heroku, and I found that after a normal boot, I start getting R14 errors relatively quickly - physical memory has exceeded the 512MB limit and is now swapping performance for performance. I need to restart applications frequently to stop R14 errors. The application is a very typical web application and I expect it to work comfortably within memory constraints.

Here is a screenshot from NewRelic showing the physical memory being exceeded. I don't actually have 59 JVMs, just the result of numerous restarts.

enter image description here

I'm not entirely clear on why "used heap" seems to affect "physical memory" when it hasn't come close to "committed heap" and why "physical memory" seems to be more closely watching "physical memory" used heap ", not" whole heap "

I used Eclipse Memory Analyzer to parse some heap heaps and the Leak Suspects report mentions play.Play and play.mvc. Router as a suspect, although I'm not sure if this was expected and / or if they are directly related to physical memory being exceeded.

enter image description here

See the generated MAT for details.

Any advice on how to resolve this would be great. I am developing OS X with Oracle Java 1.8 and cannot yet replicate the exact local Heroku environment (e.g. Ubuntu, OpenJDK 1.8) to try to reproduce the problem.

UPDATE 11/12/2014:

Here's the answer from Heroku support:


Play and, in turn, Netty, allocate direct memory ByteBuffer objects for I / O. Since they use direct memory, they will not be reported to the JVM (Netty 4.x now uses ByteBuf objects that use heap memory).

The 65MB of anonymous maps your app uses is not very rare (I've seen some use 100 + mb). Some solutions include:

  • Limiting the concurrency of your application (maybe setting play.pool )
  • Increase the dyno size to 2X dyno.
  • Reduce the Xmx setting to 256m. This will give the JVM more space for non-heap allocation.

Please let us know if these solutions don't work for you, or if you continue to experience problems after making them.

If you want to reproduce your Heroku environment locally, I recommend installing Docker and using this Docker image with your application. Let us know if you have problems with this.


+3


source to share





All Articles