Skip to content

Instantly share code, notes, and snippets.

@DeveloperMos
Created March 7, 2022 11:44
Show Gist options
  • Save DeveloperMos/e0f04c395aa612e7feb291a41c0fd1dd to your computer and use it in GitHub Desktop.
Save DeveloperMos/e0f04c395aa612e7feb291a41c0fd1dd to your computer and use it in GitHub Desktop.
postgres kernel resources

Get postgres pid number

$ pidof postgres

4170 . . . . etc.

start PostgreSQL without huge pages enabled and check the postmaster's VmPeak value

$ grep ^VmPeak /proc/4170/status

VmPeak: 6490428 kB

Huge page size

$ grep ^Hugepagesize /proc/meminfo

Hugepagesize: 2048 kB

6490428 / 2048 = (gives approximately) 3169.154296875

sysctl -w vm.nr_hugepages=3170 or in /etc/sysctl.d/99-sysctl.conf add vm.nr_hugepages=3170

reload config

sysctl - p

check

grep Huge /proc/meminfo

see that PostgreSQL currently requires this amount of shared memory

pmap 4170 | awk '/rw-s/ && /zero/ {print $2}'

147000K

postgres=# show shared_buffers;

shared_buffers


128MB (1 row)

147000K more than 128MB

https://www.postgresql.org/docs/12/kernel-resources.html

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