Ceci est une ancienne révision du document !
Notes IPC shared memory
Voir :
ipcrm/ipcmk
#Total de la RAM total=$(cat /proc/meminfo |grep MemTotal|awk '{print $2}') # 90% de la mémoire physique max ratio=0.9 # On applique le ratio et on converti en pages de 4096 shmall=$(echo $total/4096*$ratio+1 |bc) shmmax=$(echo $total*$ratio |bc) # On arrondi la valeur shmall=$(echo $shmall |sed -e 's/\..*$//') shmmax=$(echo $shmmax |sed -e 's/\..*$//') echo $shmall > /proc/sys/kernel/shmall echo $shmmax > /proc/sys/kernel/shmmax # ipcs -lm ################# ################# # Overcommit memory ? # sysctl -w vm.overcommit_memory=2 # Page size ? # getconf PAGE_SIZE # cat /proc/sys/kernel/shmmni ################# #### SEMAPHORES # http://www.postgresql.org/docs/9.1/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS # SEMMNS is the second parameter in output of cat /proc/sys/kernel/sem (default value 32000) # SEMMNI is the last parameter there, default value 128 - this is the limiting factor - SEMMNI must be at least at least ceil(max_connections / 16) # http://www.puschitz.com/TuningLinuxForOracle.shtml#TheSEMMNSParameter # http://www.postgresql.org.es/node/229 ####
Connaître la PAGE_SIZE
Voir https://en.wikipedia.org/wiki/Page_%28computer_memory%29
getconf PAGE_SIZE cat /proc/sys/kernel/shmmni
$ ipcs ------ Message Queues -------- key msqid owner perms used-bytes messages ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0052e2c1 32768 postgres 600 56 20 0x00000000 17924097 wouter 600 33554432 2 dest 0x00000000 49446914 wouter 600 524288 2 dest [...] $ ipcs -i 17924097 -m -p Shared memory Segment shmid=17924097 uid=1000 gid=1000 cuid=1000 cgid=1000 mode=01600 access_perms=0600 bytes=33554432 lpid=3808 cpid=1457 nattch=2 att_time=Fri Jul 3 10:43:28 2015 det_time=Fri Jul 3 10:43:28 2015 change_time=Fri Jul 3 10:03:00 2015
Debug
Source : http://www.makelinux.net/alp/035
The ipcs command provides information on interprocess communication facilities, including shared segments. Use the -m flag to obtain information about shared memory. For example, this code illustrates that one shared memory segment, numbered 1627649, is in use:
% ipcs -m ------ Shared Memory Segments ------- key shmid owner perms bytes nattch status 0x00000000 1627649 user 640 25600 0
If this memory segment was erroneously left behind by a program, you can use the ipcrm command to remove it.
% ipcrm shm 1627649
Periodically remove allocated semaphores which belong to the user running the plugin. This can be achieved like this (example for the user “nrpe”)
Source : http://folk.uio.no/trondham/software/check_openmanage.html
ipcrm $(ipcs -s | awk '/nrpe/ {print "-s ",$2}')
