3 ms·
Do not forget huge pages configuration in kernel - Postgres will use them and it will save a lot of RAM for large databases, esp with many connections. One of
by limaoscarjuliet 2y ago
Do not forget huge pages configuration in kernel - Postgres will use them and it will save a lot of RAM for large databases, esp with many connections.
One of the ways to configure is to continue adding nr_hugepages to kernel, restarting PG and running your workload until you see HugePages_Free growing.
E.g.:
sysctl.d/10-hugepages.conf:vm.nr_hugepages=20000
See how these are used:
[root@potato ~]# cat /proc/meminfo | grep -i huge
AnonHugePages: 4411392 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 20000
HugePages_Free: 3103
HugePages_Rsvd: 143
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 40960000 kB
- tanelpoder 2y agoAlso, for multiprocess database engines like Postgres (and Oracle), starting up and tearing down connections will be much faster with hugepages too, as the shared memory attach and detach system calls have less pagetable setup work to do in the kernel.