Postgresql计算内核共享内存?

我们正在运行PGSQL 9.2 ,以下是硬件规格

 OS: CentOS7 64bit CPU: 24 Memory: 32GB Disk: SSD 

我想计算shmmax / shmall值,那么最好的方法是什么? 我谷歌和人说50%的总内存。 但在我的箱子,我只有PGSQL运行,那么为什么不是总内存的80%?

我可以configurationkernel.shmmax 28GB吗? 并保持4G的Linux操作系统。

你有什么build议?

shmmaxshmall不是分配,它们是内核中的控制旋钮,允许您控制最大共享内存段大小和共享内存页的数量。

从sysctl文档引用:

 shmall: This parameter sets the total amount of shared memory pages that can be used system wide. Hence, SHMALL should always be at least ceil(shmmax/PAGE_SIZE). If you are not sure what the default PAGE_SIZE is on your Linux system, you can run the following command: # getconf PAGE_SIZE ============================================================== shmmax: This value can be used to query and set the run time limit on the maximum shared memory segment size that can be created. Shared memory segments up to 1Gb are now supported in the kernel. This value defaults to SHMMAX 

我build议你就这些sysctlvariables的设置提供一些build议,因为它们对于进一步调整PostgreSQL是必不可less的,而且这些build议对于所需的任务来说往往是足够的。 =)

一旦这些sysctl被设置,将shared_buffers设置为RAM的25%,并且在postgresql.conf中将effective_cache_size为75%,将有助于您有效使用服务器上的RAM。

我还推荐在调整PostgreSQL服务器上遵循PostgreSQL Wiki条目,或者获得Greg Smith的PostgreSQL 9.0高性能书籍,以获得关于正确调整和维护服务器的更多信息。 =)