本篇内容介绍了“Linux中Huge Pages的相关设置有哪些”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

PostgreSQL通过参数huge_pages设置是否启用大页,利用常驻内存用以提升性能

Check if CPU supports HugePages 2MB Size
命令如下,关键字是pse(Page Size Extension)

[root@localhost~]#cat/proc/cpuinfo|greppse|uniqflags:fpuvmedepsetscmsrpaemcecx8apicsepmtrrpgemcacmovpatpse36clflushmmxfxsrssesse2sshtsyscallnxpdpe1gbrdtscplmconstant_tscarch_perfmonnoplxtopologytsc_reliablenonstop_tscpnipclmulqdqssse3fmacx16pcidsse4_1sse4_2x2apicmovbepopcntaesxsaveavxf16crdrandhypervisorlahf_lmfsgsbasesmeparat[root@localhost~]#[root@localhost~]#cat/proc/cpuinfo|egrep-opse|head-n1pse[root@localhost~]#

Check if CPU supports HugePages 1GB Size
命令如下,关键字是pdpe1gb

[root@localhost~]#greppdpe1gb/proc/cpuinfo|head-n1flags:fpuvmedepsetscmsrpaemcecx8apicsepmtrrpgemcacmovpatpse36clflushmmxfxsrssesse2sshtsyscallnxpdpe1gbrdtscplmconstant_tscarch_perfmonnoplxtopologytsc_reliablenonstop_tscpnipclmulqdqssse3fmacx16pcidsse4_1sse4_2x2apicmovbepopcntaesxsaveavxf16crdrandhypervisorlahf_lmfsgsbasesmeparat[root@localhost~]#[root@localhost~]#egrep-opdpe1gb/proc/cpuinfo|head-n1pdpe1gb[root@localhost~]#

How to change default HugePage size?
默认大小为2MB

[root@localhost~]#grepHugepagesize:/proc/meminfoHugepagesize:2048kB[root@localhost~]#

修改命令为

[root@localhost~]#grepGRUB_CMDLINE_LINUX/etc/sysconfig/grubGRUB_CMDLINE_LINUX="crashkernel=autord.lvm.lv=centos/rootrd.lvm.lv=centos/swaprhgbquiet"[root@localhost~]#[root@localhost~]#vim/etc/sysconfig/grub[root@localhost~]#grepGRUB_CMDLINE_LINUX/etc/sysconfig/grubGRUB_CMDLINE_LINUX="crashkernel=autord.lvm.lv=centos/rootrd.lvm.lv=centos/swaprhgbquietdefault_hugepagesz=1G"[root@localhost~]#[root@localhost~]#grub2-mkconfig-o/boot/grub2/grub.cfgGeneratinggrubconfigurationfile...Foundlinuximage:/boot/vmlinuz-5.2.14-1.el7.elrepo.x86_64Foundinitrdimage:/boot/initramfs-5.2.14-1.el7.elrepo.x86_64.imgFoundlinuximage:/boot/vmlinuz-3.10.0-957.27.2.el7.x86_64Foundinitrdimage:/boot/initramfs-3.10.0-957.27.2.el7.x86_64.imgFoundlinuximage:/boot/vmlinuz-3.10.0-693.el7.x86_64Foundinitrdimage:/boot/initramfs-3.10.0-693.el7.x86_64.imgFoundlinuximage:/boot/vmlinuz-0-rescue-f0b4bffdc9e44816abd201320f8a4f75Foundinitrdimage:/boot/initramfs-0-rescue-f0b4bffdc9e44816abd201320f8a4f75.imgdone[root@localhost~]#[root@localhost~]#rebootConnectionclosedbyforeignhost.[root@localhost~]#grepHugepagesize/proc/meminfoHugepagesize:1048576kB[root@localhost~]#

“Linux中Huge Pages的相关设置有哪些”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!