Message Queues

Kurt Wall kwall
Fri Feb 3 21:42:03 PST 2006


On Wed, Feb 01, 2006 at 10:44:59PM -0700, Steve Jardine took 17 lines to write:
> Heya All,
> 
>     I have a need to send a large amount of messages over a message queue. 
> Currently, I max out at 400 entries on a specific queue. Does anyone have an idea
> what system variable I can change to increase the number of entries on a single
> queue?

Steve:

I believe the maximum number of messages is limited by the size of each 
message.

$ sysctl -a | grep msg
...
kernel.msgmnb = 16384   /* default size of a message queue */
kernel.msgmni = 16      /* maximum number of message queue ids */
kernel.msgmax = 8192    /* maximum size of a message */

So, if you have a message that is 4096 bytes, you can only get 4 of
them onto a queue. Happily, kernel.msgmnb <= INT_MAX, which is
2147483647 on my system.

So, I believe what you need to do is increase kernel.msgmnb using
sysctl. For example, you can say (as root):

# sysctl kernel.msgmnb=100000

This increases the message queue size to 100,000 bytes. You should then
be able to stuff more messages into a single queue. I haven't tested
this, of course. I'm doing that now.

Kurt
-- 
Anything that is good and useful is made of chocolate.


More information about the Linux-users mailing list