修改消息队列 最大长度

用到posix消息队列。默认的长度,肯定不够存。

1、查看当前的限制:

ipcs -l

[admin@itbu-comm-app8 ~]$ ipcs -l            

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

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

------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 65536
default max size of queue (bytes) = 65536

 2 修改:

 (1)如果只是临时变动,在命令行输入

      bash# sysctl -w kernel.msgmnb=6553600

 (2) 如果要在系统启动时改变该值,可在/etc/sysctl.conf文件中加入以下几句:

想说明一点的是,这个文件中的注释感觉写反了,

msgmnb表示的是整个队列的长度限制,

msgmax是一条消息的长度限制

 

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 6553600

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 6553600

 

3、

你可能感兴趣的:(Linux)