共計(jì) 2696 個(gè)字符,預(yù)計(jì)需要花費(fèi) 7 分鐘才能閱讀完成。
本篇內(nèi)容介紹了“Linux 中 Huge Pages 的相關(guān)設(shè)置有哪些”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓丸趣 TV 小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
PostgreSQL 通過(guò)參數(shù) huge_pages 設(shè)置是否啟用大頁(yè),利用常駐內(nèi)存用以提升性能
Check if CPU supports HugePages 2MB Size
命令如下,關(guān)鍵字是 pse(Page Size Extension)
[root@localhost ~]# cat /proc/cpuinfo | grep pse | uniq
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase smep arat
[root@localhost ~]#
[root@localhost ~]#cat /proc/cpuinfo | egrep -o pse | head -n 1
[root@localhost ~]#
Check if CPU supports HugePages 1GB Size
命令如下,關(guān)鍵字是 pdpe1gb
[root@localhost ~]# grep pdpe1gb /proc/cpuinfo | head -n 1
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase smep arat
[root@localhost ~]#
[root@localhost ~]# egrep -o pdpe1gb /proc/cpuinfo | head -n 1
pdpe1gb
[root@localhost ~]#
How to change default HugePage size?
默認(rèn)大小為 2MB
[root@localhost ~]# grep Hugepagesize: /proc/meminfo
Hugepagesize: 2048 kB
[root@localhost ~]#
修改命令為
[root@localhost ~]# grep GRUB_CMDLINE_LINUX /etc/sysconfig/grub
GRUB_CMDLINE_LINUX= crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet
[root@localhost ~]#
[root@localhost ~]# vim /etc/sysconfig/grub
[root@localhost ~]# grep GRUB_CMDLINE_LINUX /etc/sysconfig/grub
GRUB_CMDLINE_LINUX= crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet default_hugepagesz=1G
[root@localhost ~]#
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.2.14-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.2.14-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.27.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.27.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-f0b4bffdc9e44816abd201320f8a4f75
Found initrd image: /boot/initramfs-0-rescue-f0b4bffdc9e44816abd201320f8a4f75.img
[root@localhost ~]#
[root@localhost ~]# reboot
Connection closed by foreign host.
[root@localhost ~]# grep Hugepagesize /proc/meminfo
Hugepagesize: 1048576 kB
[root@localhost ~]#
“Linux 中 Huge Pages 的相關(guān)設(shè)置有哪些”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編將為大家輸出更多高質(zhì)量的實(shí)用文章!