3

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: enter image description here

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

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:

enter image description here

Lii
  • 11,553
  • 8
  • 64
  • 88
Fran Montero
  • 1,679
  • 12
  • 24
  • 1
    In java-8 You could use `G1GC` instead of `ParallelGC`. This *could* improve your performance. Atleast go for `CMS`. Also, you should perhaps set the number of threads to be used for GC – TheLostMind Sep 03 '15 at 08:22
  • thanks @TheLostMind but the question is, why behaviour is not the same than before? – Fran Montero Sep 03 '15 at 08:26
  • You should not expect similar behavior across JVMs. Too many things could have changed that lead to such output – TheLostMind Sep 03 '15 at 08:31
  • Yeah your are right, but at least i could expect a 'normal' behavior beacuse it is unusable at the moment – Fran Montero Sep 03 '15 at 08:47
  • 1
    @FranMontero How did you determine that it's not "normal" what you're seeing on Java 8? – Kayaman Sep 03 '15 at 08:48
  • Too much has changed wrt memory (where objects stay, Permgen etc) from jdk6 to jdk8. So, I am not sure if you should actually compare Memory allocation / GC behavior for these versions – TheLostMind Sep 03 '15 at 08:49
  • I'm comparing them because my production servers are running java 6 very well and same environment with java 8 and tomcat 8 is running out of eden space (0 to 400MB) continously with no traffic. There must be a leak somewhere that is producing that. Maybe is a tomcat thing, i don`t know – Fran Montero Sep 03 '15 at 08:52
  • @FranMontero - Then I suggest changing the GC rather then checking why you are having the leak. – TheLostMind Sep 03 '15 at 08:53
  • 1
    Sure, i'll try that @TheLostMind thanks – Fran Montero Sep 03 '15 at 08:55
  • @TheLostMind i've tryed all GCs but same behaviour. It seems that minor GC is being triggered even when there is free space in eden :/ – Fran Montero Sep 03 '15 at 12:21
  • a larger chunk of the GC logs would be useful. – the8472 Sep 03 '15 at 14:12
  • Same trace again and again, minor collections occur almost every second @the8472 – Fran Montero Sep 04 '15 at 06:46

1 Answers1

0

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.

Igor Mukhin
  • 15,014
  • 18
  • 52
  • 61
  • Sorry, graph with Java 6 is actual production environment with traffic. Please take a look at the related question: http://stackoverflow.com/questions/32392402/memory-allocation-behaviour-with-java-1-8-in-tomcat-6-and-tomcat-8 – Fran Montero Oct 19 '15 at 06:09