-d64 开关对 Sun JVM 常驻内存使用有什么影响(如果有)? [英] What impact, if any, does the -d64 switch have on Sun JVM resident memory usage?

查看:18
本文介绍了-d64 开关对 Sun JVM 常驻内存使用有什么影响(如果有)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个需要一些内存调整的网络应用程序.虽然我已经对应用程序本身进行了分析并进行了精简,但在我们最繁忙的实例上,JVM 本身对我来说似乎过于臃肿.(低容量实例没有这个问题.)详情:

I've got this webapp that needs some memory tuning. While I'm already profiling the application itself and trimming things down, the JVM itself seems overly bloated to me on our busiest instance. (The lower volume instances do not have this problem.) The details:

  • 平台:
    • RHEL4 64 位(Linux 2.6.9-78.0.5.ELsmp #1 SMP x86_64)
    • Sun Java 6(Java HotSpot(TM) 64 位服务器 VM(构建 10.0-b23,混合模式))
    • Tomcat 6 和 -d64startup.sh

    如果我可以重构出对 64 位 JVM 的需求,并删除 -d64 开关,这是否会使 JVM 的驻留内存占用更小?换句话说...

    If I could refactor out the need for a 64-bit JVM, and drop the -d64 switch, would that make the JVM's resident memory footprint smaller? In other words...

    -d64 开关对 Sun JVM 常驻内存使用有什么影响(如果有)?

    What impact, if any, does the -d64 switch have on the Sun JVM resident memory usage?

    推荐答案

    使用 d64 开关使 JVM 进入 64 位模式.从技术上讲,在 Solaris/Linux 和大多数 Unix 上,JVM 进程将在 LP64 模型中执行.

    Usage of the d64 switch gets the JVM into the 64-bit mode. Technically, on Solaris/Linux and most Unixes, the JVM process will execute in the LP64 model.

    LP64 模型与 32 位模型 (ILP32) 不同因为指针恰好是 64 位宽,而不是 32 位指针.对于 JVM 而言,这允许更大的内存寻址能力,但这也意味着仅对象引用所占用的大小就增加了一倍.因此,在 32 位 JVM 和 64 位 JVM 中,在给定时间内相同数量的对象会出现更大的膨胀.

    The LP64 model is different from the 32-bit model (ILP32) in that pointers happen to be 64 bit wide as opposed to 32 bit pointers. For the JVM, this allows for greater memory addressability, but it also means that the size occupied by the object references alone has doubled. So there is greater bloat for the same number of objects at a given time in a 32-bit JVM and a 64-bit one.

    另一件经常被遗忘的事情是指令本身的大小.在 64 位 JVM 上,指令的大小将占用本机机器寄存器的大小.

    Another thing that is often forgotten is the size of the instructions themselves. On a 64-bit JVM, the size of the instructions will occupy native machine register size.

    但是,如果您在 64 位环境中使用压缩对象指针,则对于大于 4 GB 的堆大小,JVM 将尽可能对指针进行编码和解码.简而言之,当您使用压缩指针时,JVM 会尝试尽可能多地使用 32 位宽的值.

    If however, you use compressed object pointers in a 64-bit environment, the JVM will encode and decode pointers whenever possible for heap sizes greater than 4 GB. Briefly stated, when you use compressed pointers, the JVM attempts to use 32-bit wide values as much as possible.

    提示:打开 UseCompressedOops 标志,使用 -XX:+UseCompressedOops 来消除一些膨胀.YMMV,但是 人们报告说,使用压缩 oops 后内存膨胀减少了 50%.

    Hint: Switch on the UseCompressedOops flag, using -XX:+UseCompressedOops to get rid of some of the bloat. YMMV, but people have reported upto 50% drop in memory bloat by using compressed oops.

    编辑

    Java HotSpot VM 14.0 版支持 UseCompressedOops 标志,可从Java 6 更新 14 及以上.

    这篇关于-d64 开关对 Sun JVM 常驻内存使用有什么影响(如果有)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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