如何为JVM启用大页内存? [英] How to enable large page memory for the JVM?

查看:200
本文介绍了如何为JVM启用大页内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在文档(jbossperformancetuning.pdf)中,建议我们为JVM启用大页内存.

In the document(jbossperformancetuning.pdf), it suggest us to enable large page memory for the JVM.

但是实际上,在我将以下内容添加到命令行/脚本启动之后: "-XX:+ UseLargePages"

But actually after I added the following to our command-line / script start-up: "-XX:+UseLargePages"

它没有用,所以我进行了更多研究,首先在OS上启用了大页面内存,然后在启动脚本中添加了"-XX:+ UseLargePages -XX:LargePageSizeInBytes = 2m".

It didn't work, so I investigated more, enabled the large page memory on OS first, then added "-XX:+UseLargePages -XX:LargePageSizeInBytes=2m" to start-up script.

但是不幸的是,它也没有起作用,所以有人可以给我们一些建议,如何为JVM成功启用大页内存吗?

But unfortunately, it didn't work neither, so could someone give us some suggestions of how to enable the large page memory for the JVM successfully?

[root @ localhost〜]#cat/proc/meminfo

[root@localhost ~]# cat /proc/meminfo

MemTotal:     37033340 kB
MemFree:        318108 kB
Buffers:        179452 kB
Cached:        5934940 kB
SwapCached:          0 kB
...
HugePages_Total: 10251
HugePages_Free:  10251
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

[root @ localhost〜]#ps aux | grep java

[root@localhost ~]# ps aux | grep java

root     22525  0.2 20.3 28801756 7552420 ?    Sl   Nov03  31:54 java -Dprogram.name=run.sh -server -Xms1303m -Xmx24g -XX:MaxPermSize=512m -XX:+UseLargePages -XX:LargePageSizeInBytes=2m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true -verbose:gc -Xloggc:/tmp/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/opt/jboss-as/lib/endorsed -classpath /opt/jboss-as/bin/run.jar org.jboss.Main -c default -b 0.0.0.0
root     31962  0.0  0.0  61200   768 pts/2    S+   22:46   0:00 grep java

[root @ localhost〜]#cat/etc/sysctl.conf

[root@localhost ~]# cat /etc/sysctl.conf

...
# JBoss is running as root, so the group id is 0
vm.hugetlb_shm_group = 0
# The pages number
vm.nr_hugepages = 12288

推荐答案

最后,我解决了此问题,首先将大页面内存设置为大于JVM堆大小,然后重新启动服务器,因为没有办法使它除非您在RHEL 6.0中将内核升级到较新的内核即可.

Finally I fixed this issue, at first set the large pages memory bigger than JVM heap size, then just reboot the server, because there is no way to make it work unless you upgrade the kernel to the newer one - in RHEL 6.0.

这篇关于如何为JVM启用大页内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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