从Java 6 + Tomcat 6升级到Java 8 + Tomcat 8时的垃圾回收器使用情况 [英] Garbage collector usage when upgrade from Java 6 + Tomcat 6 to Java 8 + Tomcat 8

查看:1024
本文介绍了从Java 6 + Tomcat 6升级到Java 8 + Tomcat 8时的垃圾回收器使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在从Java 6和Tomcat 6升级到Java 1.8.0_45和Tomcat 8.0.23,Linux服务器,64位。
我正在比较内存使用情况,并且我正面临一个奇怪的行为。



这是Eden Space在Tomcat 8中看起来与Java 8一样没有流量,刚开始和闲置:




$ b $对于我来说,看起来这首先是应用程序本身的一个问题。你说应用程序是空闲的,但图表显示(即使在Java 6中)应用程序正在分配400MB的内存并每秒释放两次。这听起来不像这个应用程序闲置。

可能你的应用程序创建了很多对象(即使它是空闲的)。 GC和优化程序在Java 8以后改变了。这可以解释不同的图。

当你期望闲置时闲置。

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:

解决方案

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.

这篇关于从Java 6 + Tomcat 6升级到Java 8 + Tomcat 8时的垃圾回收器使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆