I have a server which has 16 GB memory.
Now I need to set my shmmax
and shmall
, because the server default is (checked with ipcs -l
)
------ Messages Limits --------max queues system wide = 32000max size of message (bytes) = 8192default max size of queue (bytes) = 16384------ Shared Memory Limits --------max number of segments = 4096max seg size (kbytes) = 18014398509465599max total shared memory (kbytes) = 18014398509465599min seg size (bytes) = 1------ Semaphore Limits --------max number of arrays = 32000max semaphores per array = 32000max semaphores system wide = 1024000000max ops per semop call = 500semaphore max value = 32767
It seems terrible, shmall
and shmmax
is bigger than my 16 GB.
So I want to change the setting to
shmmax -> 16GB/4shmall -> 16GB/2
But I can't be sure what unit I have set
shmmax --> 4420960256 shmall --> 8620960256
But is the unit for my number? byte or KB?Because ipcs -l
is showing KB....
echo "kernel.shmmax=4420960256">> /etc/sysctl.confecho 4420960256> /proc/sys/kernel/shmmaxecho "kernel.shmall=8620960256">> /etc/sysctl.confecho 8620960256> /proc/sys/kernel/shmall
thanks for help, but the postgresql just crash and get killed by yesterday, it shows :
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.
my setting =>
shared_buffers = 4GBeffective_cache_size = 12GB