Garbage collector usage when upgrade from Java 6 + Tomcat 6 to Java 8 + Tomcat 8

若如初见. 提交于 2019-12-07 12:31:57

问题


We are upgrading from Java 6 and Tomcat 6 to Java 1.8.0_45 and Tomcat 8.0.23, Linux servers, 64 bits. I'm comparing memory usage and I'm facing a weird behaviour.

This is how Eden Space looks with Java 8 in Tomcat 8 with no traffic, just started and idle:

And this is how it looks with Java 6, standard to me:

Both JVMs are configured the same way, basically:

XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+DisableExplicitGC -Xms768m -Xmx2048m -Xmn400m

With Java 8 and Tomcat 8 minor GC are almost always running and tomcat log show this:

1301,121: [GC (Allocation Failure) [PSYoungGen: 408960K->352K(409088K)] 1126151K->717559K(1915392K), 0,0093033 secs] [Times: user=0,02 sys=0,00, real=0,01 secs]

Do you know some special configuration for JVM 8 or something I have to do to have the same behaviour than before?

EDIT:

After 30 min, Eden Space is:


回答1:


To me it looks like this is a problem with the application itself in the first place. You said the application is idle but the graph shows (even in Java 6) that the application is allocating 400MB of memory and freeing it up twice a second. It really doesn't sound like this application is idle.

Possibly your application creates many objects (even when it's "idle"). GC and Optimizer were changed in Java 8 since Java 6. This could explain the different graphs.

But anyway, I would start with trying to find out why the application is not idle when you expect it to be idle.



来源:https://stackoverflow.com/questions/32370453/garbage-collector-usage-when-upgrade-from-java-6-tomcat-6-to-java-8-tomcat-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!