Skip to content

Instantly share code, notes, and snippets.

@akhdaniel
Last active January 10, 2025 04:20
Show Gist options
  • Select an option

  • Save akhdaniel/432f9fffa42f03b9f205c4b280991abe to your computer and use it in GitHub Desktop.

Select an option

Save akhdaniel/432f9fffa42f03b9f205c4b280991abe to your computer and use it in GitHub Desktop.
#!/bin/bash
# sesuaikan dengan lokasi folder PG masing-masing
PGDATA=/var/lib/postgresql/9.5/main
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
@jackysupit
Copy link

Terima kasih Pak Daniel.

Buat temen-temen yang masih pemula di linux, enggak pakai akun root mungkin ada yang bingung file ini gimana cara pakainya? Bisa ikuti langkah berikut:

  1. nano check-huge-pages.sh
  2. copy isi file ini, lalu paste di check-huge-pages.sh
  3. sesuaikan lokasi PGDATA (yaitu directory dimana file postmaster.id anda berada). biasanya cukup ganti versi aja baris 3 di file ini dengan versi postgresql Anda.
  4. keluar dari nano, lalu ketik: chmod +x check-huge-pages.sh
  5. sudo ./check-huge-pages.sh

saya harus pakai sudo, karena saya tidak menggunakan akun root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment