# how to know how many of a sysctl is used?



## fluca1978 (Jan 30, 2012)

Hi,
this could be trivial, but in order to do a fine tuning, I'd like to know, having a set of daemons running, how much of a kern.ipc.* sysctl are using globally. For instance, how can I get how many kern.ipc.shmmax memory is used or kern.ipc.shmmni semaphores?


----------



## fluca1978 (Feb 1, 2012)

I found an interesting command, ipcs(1), but the man page is not clear to me, and the output of the command is not too. Anyone can give me an hint about how to extract information from such command?


----------



## RedRat (Feb 2, 2012)

*ipcs -T* will show you current limits for System V message queues, shared memory and semaphores:


```
ku-new:home/support# ipcs -T
msginfo:
        msgmax:        16384    (max characters in a message)
        msgmni:           40    (# of message queues)
        msgmnb:         2048    (max characters in a message queue)
        msgtql:           40    (max # of messages in system)
        msgssz:            8    (size of a message segment)
        msgseg:         2048    (# of message segments in system)

shminfo:
        shmmax:    268435456    (max shared memory segment size)
        shmmin:            1    (min shared memory segment size)
        shmmni:          192    (max number of shared memory identifiers)
        shmseg:          128    (max shared memory segments per process)
        shmall:        65536    (max amount of shared memory in pages)

seminfo:
        semmap:           60    (# of entries in semaphore map)
        semmni:           10    (# of semaphore identifiers)
        semmns:          120    (# of semaphores in system)
        semmnu:           60    (# of undo structures in system)
        semmsl:           60    (max # of semaphores per id)
        semopm:          100    (max # of operations per semop call)
        semume:           20    (max # of undo entries per process)
        semusz:          152    (size in bytes of undo structure)
        semvmx:        32767    (semaphore maximum value)
        semaem:        16384    (adjust on exit max value)
```
*ipcs -a* will show you current usage of resourses and who consumes it:

```
ku-new:home/support# ipcs -a
Message Queues:
T           ID          KEY MODE        OWNER    GROUP    CREATOR  CGROUP  CBYTES QNUM QBYTES LSPID LRPID STIME RTIME CTIME

Shared Memory:
T           ID          KEY MODE        OWNER    GROUP    CREATOR  CGROUP  NATTCH    SEGSZ   CPID   LPID ATIME    DTIME    CTIME
m        65536      5432001 --rw------- pgsql    pgsql    pgsql    pgsql   26    144728064   1107   1107 23:07:12 19:36:44 23:07:12
m       524289      5432002 --rw------- 71       71       71       71      10     10477568  62918  62918 16:32:52 19:36:33 16:32:52

Semaphores:
T           ID          KEY MODE        OWNER    GROUP    CREATOR  CGROUP   NSEMS OTIME    CTIME
s        65536      5432001 --rw------- pgsql    pgsql    pgsql    pgsql      17 19:36:31 23:07:12
s        65537      5432002 --rw------- pgsql    pgsql    pgsql    pgsql      17 19:36:46 23:07:12
s        65538      5432003 --rw------- pgsql    pgsql    pgsql    pgsql      17 19:36:27 23:07:12
s       524291      5432004 --rw------- 71       71       71       71         17 16:30:18 16:32:52
```


----------

