Linux

Postgresql 計算核心共享記憶體?

  • November 17, 2015

我們正在執行PGSQL 9.2,以下是硬體規格

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

我想計算 shmmax/shmall 值那麼什麼是好方法?我用Google搜尋,人們說佔總記憶體的 50%。但是在我的機器上我只執行了 PGSQL,那為什麼不佔總記憶體的 80%?

我可以配置kernel.shmmax28GB嗎?並為 Linux 作業系統保留 4G。

你有什麼建議?

shmmax並且shmall不是分配,它們是核心中的控制旋鈕,允許您控制最大共享記憶體段大小和共享記憶體頁數。

引用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

我建議您採納有關這些 sysctl 變數設置的建議,因為它們對於能夠進一步調整 PostgreSQL 至關重要,而且這些建議對於所需的任務通常綽綽有餘。=)

一旦設置了這些 sysctl,設置shared_buffers為 RAM 的 25% 和effective_cache_size75%postgresql.conf將使您開始有效地使用伺服器上的 RAM。

我還建議關注關於Tuning Your PostgreSQL Server的 PostgreSQL Wiki 條目,或者獲取 Greg Smith 的 PostgreSQL 9.0 High Performance 一書,以獲取有關正確調整和維護伺服器的更多資訊。=)

引用自:https://serverfault.com/questions/735351