gpt4 book ai didi

Linux shmmax 和 shmall - 如何设置正确的单位?

转载 作者:太空宇宙 更新时间:2023-11-04 12:00:16 27 4
gpt4 key购买 nike

我有一台内存为 16 GB 的服务器。

现在我需要设置我的 shmmaxshmall,因为服务器默认是(用 ipcs -l 检查)

------ Messages Limits --------
max queues system wide = 32000
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 18014398509465599
max total shared memory (kbytes) = 18014398509465599
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 32000
max semaphores per array = 32000
max semaphores system wide = 1024000000
max ops per semop call = 500
semaphore max value = 32767

看起来很糟糕,shmallshmmax 比我的 16 GB 还大。

所以我想把设置改成

shmmax -> 16GB/4
shmall -> 16GB/2

但我不能确定我设置的是什么单位

shmmax --> 4420960256 
shmall --> 8620960256

但是我的号码是单位吗?字节还是KB?因为 ipcs -l 正在显示 KB....

echo "kernel.shmmax=4420960256" >> /etc/sysctl.conf
echo 4420960256> /proc/sys/kernel/shmmax
echo "kernel.shmall=8620960256" >> /etc/sysctl.conf
echo 8620960256> /proc/sys/kernel/shmall

感谢您的帮助,但 postgresql 刚刚崩溃并在昨天被杀死,它显示:

This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 4420960256 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.

我的设置=>

shared_buffers = 4GB
effective_cache_size = 12GB

最佳答案

只需使用:

lsipc

在我的 Ubuntu 16.04 LTS 上我得到:

RESOURCE DESCRIPTION                                    LIMIT USED  USE%
MSGMNI Number of message queues 32000 0 0.00%
MSGMAX Max size of message (bytes) 8192 - -
MSGMNB Default max size of queue (bytes) 16384 - -
SHMMNI Shared memory segments 4096 20 0.49%
SHMALL Shared memory pages 2097152 4915 0.23%
SHMMAX Max size of shared memory segment (bytes) 4294967296 - -
SHMMIN Min size of shared memory segment (bytes) 1 - -
SEMMNI Number of semaphore identifiers 128 0 0.00%
SEMMNS Total number of semaphores 32000 0 0.00%
SEMMSL Max semaphores per semaphore set. 250 - -
SEMOPM Max number of operations per semop(2) 100 - -
SEMVMX Semaphore max value 32767 - -

它清楚地说明了我在 /etc/sysctl.conf 中指定的值的度量单位。所以对我来说 SHMMAX 以字节为单位,而 SHMALL 以页为单位(参见 getconf PAGE_SIZE)。

关于Linux shmmax 和 shmall - 如何设置正确的单位?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52751256/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com