Applications is slowing with metaspace growth

Viewed 613

I just moved from grails 2.4.3 to grails 2.5.6 and from Java 7 to Java 8. I'm trying to set optimal metaspace size in my app.

Actual metaspace size has big impact on application performance:

Used metaspace and response avg time:

  • 200 MB - 339 ms
  • 300 MB - 380 ms
  • 400 MB - 430 ms
  • 500 MB - 460 ms
  • 600 MB - 530 ms

Metaspace is growing from application start to 620MB in 90 minutes.

This is my actual gc settings:

 -Xms14G -Xmx14G\
 -XX:+UseG1GC\
 -XX:ParallelGCThreads=8\
 -XX:ConcGCThreads=4\
 -XX:MaxGCPauseMillis=200\
 -XX:+UseLargePages\
 -XX:+UseLargePagesInMetaspace\
 -XX:+AlwaysPreTouch\
 -XX:InitialBootClassLoaderMetaspaceSize=512M\
 -XX:MetaspaceSize=512M\
 -XX:MinMetaspaceExpansion=8M\
 -XX:MaxMetaspaceExpansion=32M\
 -XX:+UseStringDeduplication\
 -XX:+ParallelRefProcEnabled\
 -XX:-TieredCompilation\

When MaxMetaspaceSize was set to 512M then after few hours of running my app is slowing down 1 or 2 times for hour. Respons time is around 10 seconds then.

Anyone had such problem? In yours applications metaspace has such impact on performance?

1 Answers

Have you profiled your app?

I'd say that Metaspace garbage collection was involved here. It collects dead classes and classloaders and it's triggered once the class metadata usage reaches the MaxMetaspaceSize (which was narrowed by -XX:MaxMetaspaceSize).

Related