CPU usage too high

Hello everyone

We are building web-applications with the Play! Framework. We get good performance out of the framework but we realize that some installations on the servers have high CPU usage.

A funny observation on a specific installation:

  • The Application only checks Auth, selects one entry from a DB and returns it as an answer. (No Actors, no schedulers)
  • The Application was not used anymore for a long time. (No request coming in for months)
  • The CPU usage was very high.
  • After restarting, the CPU usage got to almost 0.

We have uncommonly high CPU usage on other applications as well so we are trying to find out what possible causes could be. The paths we are currently following are:

  • Is there some issue with the garbage collector? (We’ve read that the garbage collector could kick in too often and cause this)
  • We’ve read about thread pools and blocking code. We understand that this could affect the performance of the application but we don’t see why the CPU usage should go high when using just one thread pool.

Currently we are setting up some test environment. But before going down a long path in the wrong direction, probalby someone can give us a hint in a direction we didn’t think yet?

I recently tried upgrading a Play project from Java 8 to Java 11 and I saw unusually high CPU usage for no good reason. I think it’s actually caused by a bug in Java 11 (another link) and as soon as I downgraded back to Java 8 the problem went away.

So if you are using Java 11, then that could be the cause.

Hi @slisaasquatch and @MichaelHugi,

the JDK11 issues that @slisaasquatch linked are interesting but a bit outdated and easy to fix by using the latest release of JDK11.
@MichaelHugi maybe a reproducer or more details re exact versions of Play, db drivers, other dependencies and even the JVM vendor and version can help narrow down the issue.


Not necessarily related to this particular issue, but the Java 11 version I used was 11.0.9, which is pretty recent, and it definitely still suffers from the high CPU usage issue.

Thanks for the suggestions.

  • We are using JRE8 on all installations (and therefore JDK8 for development)
  • All servers are Windows servers


  • We have installations on different Play! 2 versions. 2.3 up to Play! 2.8
  • Db drivers are: org.h2.Driver, sybase.jdbc4.sqlanywhere.IDriver, com.mysql.jdbc.Driver (on the simple application described in the post only sybase.jdbc4.sqlanywhere.IDriver is used but we get the issue also on projects that only use the h2 and mysql drivers)
  • We use Ebean on all projects as dependency

I ran into this issue, which I think is the same as: Java Play 2.7 processes stuck at 100% CPU on Linux server

I was able to fix it by adding this to the Java executable command line parameters:
-XX:ReservedCodeCacheSize=384m -XX:+UseCodeCacheFlushing