Added Message Queue Length in Linux

Source: Internet
Author: User

The message queue is often created, and no space left on device is reported.

In this case, you can modify the msgmni parameter.

Msgmni --- this parameter determines the maximum number of Message Queue running simultaneously in the system.

 

Msgmni: The value is defined in the/proc/sys/kernel/msgmni file;

Function: defines the maximum length of a message queue. To make DB2 (version 7.1) run normally, the minimum value is 128;

For high-load DB2 servers, you can adjust this value to> = 1024;

Tuning: For kernel 2.4.6, the default value is 16. You can change this value in either of the following ways:

(1) If only temporary changes are made, enter

Bash # sysctl-W kernel. msgmni = 128

(2) If you want to change the value when the system starts, add the following sentence to the/etc/sysctl. conf file:

# Sets maximum number of message queues to 128

# Set this to 1024 or higher on production systems

Kernel. msgmni= 128

(Use the IPCS-l command to view the settings of the current IPC parameter)

P.s.

Other parameters,

Kernel. msgmni
Kernel. msgmax
Kernel. msgmnb

Bytes -----------------------------------------------------------------------------------

Linux restrictions on the size of messages in message queues

In a message queue, for example, the msgsnd function (INT msqid, const void * msgp, size_t msgsz, int msgflg); when this function is called, msgsz can be up to 8192, that is, power 16 of 2. It can be seen that the msgsz size is limited to one short type. If the size exceeds this value, an error occurs -- invalid argument. As not mentioned by others, as long as msgsz is the size of mtext, no error will occur. If sizeof (mtype) + sizeof (mtext) <= 8192, msgsz is sizeof (mtype) + sizeof (mtext) size does not matter.

Of course, the size of msgsz cannot be changed. If you want to change it, just change the size of msgsz in the kernel code about the program implementing message queue. (I have never tried it. It should be fine.) Generally, mqueue is contained in the IPC folder of the kernel source code. c. The C language program file will define dflt_msgsizemax as 8192, Which is why msgsz is up to 8192. If you want to change it, you can change it and re-compile the kernel.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.