java8可以用tomcat6,Tomcat 6和Tomcat 8中Java 1.8的内存分配行为

I have a set of webapps, compiled with Java 8. If I run them in Tomcat 8, I get a lot of minor GC collections with a random memory allocation. In Tomcat 6 memory allocation is more linear and stable (idle in both cases, no traffic).

Eden Space Tomcat 8:

M0Hqh.png

lrW1E.png

Eden Space Tomcat 6:

5NwBQ.png

X8QxZ.png

Do you know why that happens?

EDIT 1:

These are the data from production environment with jdk 1.8 and Tomcat 8.

CPU is really high almost always due to GC cycles. Any comments about that?

XHrHk.png

i4cLE.png

EDIT 2:

This is a heapdump analisis (1.8GB dump):

tZjtl.png

解决方案

This is eden space, not the tenured space. So, that alone is good news.

But that step of memory appears to be tomcat8 allocating something right away after a young GC. Could it be some 'balloon' technique? (allocating a large weakly referenced buffer to 'deflate' rapidly to ensure some room in case of memory pressure). It may hide in NIO connectors too, as in the 'oomParachute' parameter (1 MB by default, but is it per httpprocessor thread? If you had 200 min threads, that would match the 200 MB seen).

I will only suggest that you can drill into the changelog to find new thing or changes that you might think they implemented wastefully like such balloon mechanism.

ALSO: you should run the tomcat6 in your jdk8 to see if it is really tomcat8 at fault. The eden space could be made larger, just in case the G1GC is so aggressive that it feels obligated to GC when a mere 200MB is used.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值