Log on to the server as the os user that owns the PostgreSQL server. On my server, this user is called "postgres":
su - postgresCreate a file called find_hp.sh. Insert the following:
#!/bin/bash
pid=`head -1 $PGDATA/postmaster.pid`
echo "Pid: $pid"
peak=`grep ^VmPeak /proc/$pid/status | awk '{ print $2 }'`
echo "VmPeak: $peak kB"
hps=`grep ^Hugepagesize /proc/meminfo | awk '{ print $2 }'`
echo "Hugepagesize: $hps kB"
hp=$((peak/hps))
echo Set Huge Pages: $hp
Make sure the environment variable $PGDATA is set.
Give the script execution rights:
chmod 755 find_hp.shExecute it, and it will tell you how many huge pages you need:
./find_hp.sh Pid: 128678 VmPeak: 68986484 kB Hugepagesize: 2048 kB Set Huge Pages: 33684I can now proceed to allow for 33684 huge pages on my system with
sysctl -w vm.nr_hugepages=33684
No comments:
Post a Comment