200
Follow the below steps to enable HugePages in PostgreSQL server.
[root@test-machine02 ~]#
[root@test-machine02 ~]# ps -ef|grep postmaster
root 6795 94656 0 14:59 pts/1 00:00:00 grep --color=auto postmaster
postgres 100818 1 0 Nov14 ? 00:00:30 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
[root@test-machine02 ~]#
[root@test-machine02 ~]#
[root@test-machine02 ~]# grep ^VmPeak /proc/100818/status
VmPeak: 406236 kB
[root@test-machine02 ~]#
[root@test-machine02 ~]# grep ^Huge /proc/meminfo
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
[root@test-machine02 ~]#
[root@test-machine02 ~]#
[root@test-machine02 ~]# vi /etc/sysctl.conf
#Hugepage setting
vm.nr_hugepages = 200
:wq!
[root@test-machine02 ~]#
[root@test-machine02 ~]#
[root@test-machine02 ~]# systemctl stop postgresql-13
[root@test-machine02 ~]#
[root@test-machine02 ~]#
[root@test-machine02 ~]# sysctl -p
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
vm.nr_hugepages = 200
[root@test-machine02 ~]#
[root@test-machine02 ~]#
[root@test-machine02 ~]#
[root@test-machine02 ~]# grep ^Huge /proc/meminfo
HugePages_Total: 200
HugePages_Free: 200
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
[root@test-machine02 ~]#
[root@test-machine02 ~]# cd /var/lib/pgsql/13/data/
[root@test-machine02 data]# vi postgresql.conf
huge_pages = on
:wq!
[root@test-machine02 data]#
[root@test-machine02 data]#
[root@test-machine02 data]# systemctl start postgresql-13
[root@test-machine02 data]#
[root@test-machine02 data]#
[root@test-machine02 data]# grep ^Huge /proc/meminfo
HugePages_Total: 200
HugePages_Free: 191
HugePages_Rsvd: 64
HugePages_Surp: 0
Hugepagesize: 2048 kB
[root@test-machine02 data]#