简体   繁体   English

在64位Linux上发生意外的JVM行为

[英]Unexpected JVM behaviour on 64bit linux

i tried to compare my java web app behaviour on 32 bit windows and 64 bit linux. 我试图比较32位Windows和64位Linux上的Java Web应用程序行为。

When i view the memory usage via jconsole i find very different graph of memory usage. 当我通过jconsole查看内存使用情况时,我发现内存使用情况的图表非常不同。 On windows the appl never touches 512m. 在Windows上,应用程序永远不会触及512m。 However when i run on linux 64bit with 64 bit VM the memory keeps invcreasing gradually and reaches peak value about1000m very quickly and i also get oome error related to GC over head limit exceeded. 但是,当我在具有64位VM的Linux 64位Linux上运行时,内存会逐渐增加,并很快很快达到峰值约1000m,而且我还收到与超出GC开销限制有关的oome错误。 on linux whenever i do manual run GC it drops below to less than 100m. 在Linux上,每当我手动运行GC时,它就会下降到小于100m。

Its like the GC does seem to run so well as it does on windows. 就像GC似乎在Windows上一样好运行。

On windows the app runs better with even more load. 在Windows上,该应用在负载更大的情况下运行效果更好。

How do i find the reason behind this? 我如何找到背后的原因?

Iam using jdk1.6.0.13 IAM使用JDK1.6.0.13

min heap:512m and max heap 1024m 最小堆:512m和最大堆1024m

EDIT: 编辑:

  • Are you using the same JVM versions on both Windows and Linux? 您是否在Windows和Linux上使用相同的JVM版本?

    • yes.1.6.0.13. yes.1.6.0.13。
  • Are you using the same garbage collectors on both systems? 您是否在两个系统上使用相同的垃圾收集器?

    • I noticed in jconsole and i see that the gc are different. 我在jconsole中注意到,我发现gc有所不同。
  • Are you using the same web containers on both systems? 您是否在两个系统上使用相同的Web容器?

    • yes.Tomcat. yes.Tomcat。
  • Does your webapp rely on native libraries? 您的Web应用程序是否依赖本机库?

    • Not sure. 不确定。 I use tomcat+spring+hibernate+jsf. 我使用tomcat + spring + hibernate + jsf。
  • Are there other differences in the configuration of your webapp on the two platforms? 这两个平台上的Webapp配置是否还有其他差异? No 没有

  • What exactly was the error message associated with the OOME? 与OOME相关的错误消息到底是什么?

    • java.lang.OutOfMemoryError: GC overhead limit exceeded java.lang.OutOfMemoryError:超出了GC开销限制
  • How long does it take for your webapp to start misbehaving / reporting errors on Linux? 您的Web应用程序开始在Linux上行为不正常/报告错误需要多长时间?

    • The difference in usage pattern is seen after i leave it running for say 3hrs. 在我让它运行3个小时后,可以看到使用模式的差异。 The error appears after like a day or 2 days since by then avg memory usage is seen around 900 mb mark. 该错误大约在一天或两天后出现,因为此时可以看到平均内存使用量约为900 mb标志。

A 64bit JVM will naturally use a lot more memory than a 32bit JVM, that's to be expected (the internal pointers are twice the size, after all). 可以预料,与32位JVM相比,64位JVM自然会使用更多的内存(毕竟内部指针的大小是其两倍)。 You can't keep the same heap settings when moving from 32bit to 64bit and expect the same behaviour. 从32位迁移到64位时,您不能保持相同的堆设置,并且期望相同的行为。

If your app runs happily in 512m on a 32bit JVM, there are no reasons whatsoever to use a 64bit JVM. 如果您的应用在32位JVM上以512m的速度愉快地运行,则没有任何理由使用64位JVM。 The only rationale for doing that is to take advantage of giant heap sizes. 这样做的唯一理由是利用巨大的堆大小。

Remeber, it's perfectly valid to run a 32bit JVM on a 64bit operating system. 请记住,在64位操作系统上运行32位JVM是完全有效的。 The two are not related. 两者无关。

There are too many unknowns to be able to explain this: 有太多未知数无法解释:

  • Are you using the same JVM versions on both Windows and Linux? 您是否在Windows和Linux上使用相同的JVM版本?
  • Are you using the same garbage collectors on both systems? 您是否在两个系统上使用相同的垃圾收集器?
  • Are you using the same web containers on both systems? 您是否在两个系统上使用相同的Web容器?
  • Does your webapp rely on native libraries? 您的Web应用程序是否依赖本机库?
  • Are there other differences in the configuration of your webapp on the two platforms? 这两个平台上的Webapp配置是否还有其他差异?
  • What exactly was the error message associated with the OOME? 与OOME相关的错误消息到底是什么?
  • How long does it take for your webapp to start misbehaving / reporting errors on Linux? 您的Web应用程序开始在Linux上行为不正常/报告错误需要多长时间?

Also, I agree with @skaffman ... don't use a 64bit JVM unless your application really requires it. 另外,我也同意@skaffman的观点……除非您的应用程序确实需要它,否则请不要使用64位JVM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM