Mq ipc settings

Source: Internet
Author: User
Linux IPC parameter settings-command method: Echo 80>/proc/sys/Vm/overcommit_ratio, etc

Msgmnb
Maximum byte limit for each message queue.

Msgmni
The maximum number of message queues of the entire system.

Msggsz
The size (in bytes) of the message segment ). Messages greater than this value are divided into multiple segments.

Msgseg
The maximum number of message segments that can exist in a single queue.

Msgtql
The maximum number of messages in the system.

Msgmax
The maximum size of a single message. In some operating systems such as BSD, you do not need to set this. BSD automatically sets it to msgssz * msgseg. In other operating systems, you may need to change the default value of this parameter. You can set it to be the same as msgmnb.

Shmseg
The maximum number of shared memory segments for each process.

Shmmni
System-level limit on the number of shared memory segments.

Shmmax
The maximum size of a single shared memory segment.

Shmall
System-level limit on the number of allocable shared memory. In some systems, Shmall may indicate the number of pages rather than the number of bytes.


Configure the message queue in Linux and add the following lines to/etc/sysctl. conf:
For example:

Kernel. msgmnb = 8192
Kernel. msgmni = 40
Kernel. msgmax = 8192
Kernel. Shmall = 2097152
Kernel. shmmni = 32
Kernel. shmmax = 16777216


Run:
Insserv boot. sysctl
Boot. sysctl start


Others: /Proc/sys/kernel/Optimization
1)/proc/sys/kernel/Ctrl-alt-del
This file has a binary value that controls how the system responds when receiving a combination of CTRL + ALT + Delete keys. The two values are:
If the value is zero (0), CTRL + ALT + Delete is captured and sent to the INIT program. This allows the system to close and restart safely, just as if it had entered the shutdown command.
A value of 1 indicates that the command CTRL + ALT + Delete is not captured, and an abnormal shutdown is executed, as if the power is directly turned off.
Default Value: 0.
It is recommended to set: 1 to prevent unexpected restart caused by pressing CTRL + ALT + Delete.
2) proc/sys/kernel/msgmax
This file specifies the maximum length (bytes) of messages sent from one process to another ). Messages are transmitted between processes in the kernel memory and are not exchanged to the disk. Therefore, if this value is added, the memory used by the operating system is increased.
Default: 8192
3)/proc/sys/kernel/msgmnb
This file specifies the maximum length of a Message Queue (bytes ).
Default: 16384
4)/proc/sys/kernel/msgmni
This file specifies the maximum number of Message Queue IDs, that is, the maximum number of message queues in the system range.
Default setting: 16
5)/proc/sys/kernel/panic
This file indicates the waiting time (in seconds) of the kernel before the reboot in the event of "kernel panic ).
Zero (0) seconds indicates that automatic reboot is prohibited in the event of a serious kernel error.
Default Value: 0.
6) proc/sys/kernel/Shmall
This file indicates the total amount of shared memory (bytes) that can be used by the system at any given time point ).
Default: 2097152
7)/proc/sys/kernel/shmmax
This file indicates the size (bytes) of the maximum shared memory segment allowed by the kernel ).
Default: 33554432
Recommended: physical memory * 50%

Actual maximum available shared memory segment size = shmmax * 98%, of which approximately 2% is used for the shared memory structure.
You can set shmmax and then run IPCS-L for verification.
8)/proc/sys/kernel/shmmni
This file indicates the maximum number of shared memory segments used for the entire system ).
Default: 4096
9)/proc/sys/kernel/threads-max
This file indicates the maximum number of threads that the kernel can use.
Default: 2048
10)/proc/sys/kernel/SEM
This file is used to control the kernel semaphores. The semaphores are the methods used by system vipc for inter-process communication.

Recommended: 250 32000 100 128
The first column indicates the maximum number of semaphores in each signal set.
The second column indicates the total number of semaphores in the system range.
The third column indicates the maximum number of system operations when each signal occurs.
The fourth column indicates the total number of signal sets in the system range.
Therefore, (first column) * (fourth column) = (second column)

The preceding settings can be verified by executing IPCS-L.
  /Proc/sys/Vm/Optimization
1)/proc/sys/Vm/block_dump
This file indicates whether the block debug mode is enabled. It is used to record all read/write and dirty block write-back actions.
Default setting: 0. Disable block debug mode.
2)/proc/sys/Vm/dirty_background_ratio
This file indicates the percentage of dirty data in the system's overall memory. At this time, the pdflush process is triggered to write the dirty data back to the disk.
Default setting: 10
3)/proc/sys/Vm/dirty_expire_centisecs
This file indicates that if the residence time of dirty data exceeds this value in the memory, the pdflush process will write the data back to the disk next time.

Default setting: 3000 (1/100 seconds)
4)/proc/sys/Vm/dirty_ratio
This file indicates the percentage of dirty data generated by the process to the overall memory of the system. At this time, the process writes the dirty data back to the disk.
Default setting: 40
5)/proc/sys/Vm/dirty_writeback_centisecs
This file indicates how long the pdflush process writes dirty data back to the disk at a periodic interval.
Default setting: 500 (1/100 seconds)
6)/proc/sys/Vm/vfs_cache_pressure
This file indicates that the kernel recycles the preference of directory and inode cache memory. The default value 100 indicates that the kernel will keep directory and inode cache in a reasonable percentage based on pagecache and swapcache; reducing this value below 100 will lead to kernel preference to keep directory and inode cache; increasing this value over 100 will lead to kernel preference to reclaim directory and inode cache.
Default: 100
7)/proc/sys/Vm/min_free_kbytes
This file indicates the minimum number of idle memory (Kbytes) reserved by the Linux VM ).
Default setting: 724 (MB physical memory)
8)/proc/sys/Vm/nr_pdflush_threads
This file indicates the number of currently running pdflush processes. When the I/O load is high, the kernel will automatically add more pdflush processes.
Default setting: 2 (read-only)
9)/proc/sys/Vm/overcommit_memory
This file specifies the kernel memory allocation policy. The value can be 0, 1, or 2.
0 indicates that the kernel will check whether there is enough available memory for use by the process. If there is enough available memory, the memory application will be allowed; otherwise, the memory application will fail, and return the error to the application process.
1 indicates that the kernel allows all physical memory allocation regardless of the current memory status.
2, indicating that the kernel can allocate more memory than the total physical memory and swap space (refer to overcommit_ratio ).
Default Value: 0.
10)/proc/sys/Vm/overcommit_ratio
This file indicates that if overcommit_memory = 2, the percentage of memory can be overloaded. The following formula is used to calculate the overall available memory of the system.
System allocable memory = swap space + physical memory * overcommit_ratio/100
Default setting: 50 (%)
11)/proc/sys/Vm/page-Cluster
This file indicates the number of pages written when writing to the swap area once. 0 indicates 1 page, 1 indicates 2 pages, and 2 indicates 4 pages.
Default settings: 3 (3 to the power of 2, 8 pages)
12)/proc/sys/Vm/swapiness
This file indicates the extent to which the system performs swap. The higher the value (0-100), the more likely disk swap will occur.
Default setting: 60
13) legacy_va_layout
This file indicates whether to use the latest 32-bit shared memory MMAP () system call. Linux supports shared memory allocation methods including MMAP (), POSIX, and system vipc.
0. Use the latest 32-bit MMAP () System Call.
1. Use the system call provided by kernel 2.4.
Default Value: 0.
14) nr_hugepages
This file indicates the number of hugetlb pages retained by the system.
15) hugetlb_shm_group
This file allows you to use the hugetlb page to create the system group ID of the system vipc shared memory segment.
  /Proc/sys/fs/Optimization
1)/proc/sys/fs/file-max
This file specifies the maximum number of file handles that can be allocated. If the error message is declared as enabled
The maximum number of files has been reached, so that they cannot open more files, you may need to increase this value.
Default: 4096
Recommended: 65536
2)/proc/sys/fs/file-NR
This file is related to file-Max. It has three values:
Number of allocated file handles
Number of file handles used
Maximum number of file handles
This file is read-only and only used to display information.

/Proc/sys/NET/CORE/Optimization
The configuration file in this directory is mainly used to control the interaction between the kernel and the network layer.
1)/proc/sys/NET/CORE/message_burst
The time required to write a new warning message (in 1/10 seconds). Other warning messages received by the system are discarded. This is used to prevent Denial of Service (Denial of Service) Attacks by certain people who attempt to "flood" the system with messages.
Default setting: 50 (5 seconds)
2)/proc/sys/NET/CORE/message_cost
This file indicates the cost of writing each warning message. The larger the value, the more likely it is to ignore the warning message.
Default setting: 5
3)/proc/sys/NET/CORE/netdev_max_backlog
This file indicates the maximum number of packets allowed to be sent to the queue when each network interface receives packets at a rate faster than the rate at which the kernel processes these packets.
Default: 300
4)/proc/sys/NET/CORE/optmem_max
This file indicates the maximum buffer size allowed by each socket.
Default: 10240
5)/proc/sys/NET/CORE/rmem_default
This file specifies the default value of the buffer size of the receiving socket (in bytes ).
Default: 110592
6)/proc/sys/NET/CORE/rmem_max
This file specifies the maximum buffer size of the received socket (in bytes ).
Default: 131071
7)/proc/sys/NET/CORE/wmem_default
This file specifies the default value of the buffer size of the sending socket (in bytes ).
Default: 110592
8)/proc/sys/NET/CORE/wmem_max
This file specifies the maximum size of the buffer for sending Sockets (in bytes ).

Default: 131071

/Proc/sys/NET/IPv4/Optimization
1)/proc/sys/NET/IPv4/ip_forward
Indicates whether IP Forwarding is enabled.
0, forbidden
1. Forwarding
Default Value: 0.
2)/proc/sys/NET/IPv4/ip_default_ttl
This file indicates the time to live of a datagram, that is, the maximum number of routers that can pass through.

Default settings: 64
Increasing this value will reduce system performance.
3)/proc/sys/NET/IPv4/ip_no_pmtu_disc
This file indicates that the path MTU detection function is disabled globally.
Default Value: 0.
4)/proc/sys/NET/IPv4/route/min_pmtu
This file indicates the minimum MTU size.
Default: 552
5)/proc/sys/NET/IPv4/route/mtu_expires
This file indicates how long the PMTU information is cached (in seconds ).
Default setting: 600 (seconds)
6)/proc/sys/NET/IPv4/route/min_adv_mss
This file indicates the minimum MSS (maximum segment size) size, depending on the first hop router MTU.

Default setting: 256 (bytes)
6.1 IP fragmentation
1)/proc/sys/NET/IPv4/ipfrag_low_thresh/proc/sys/NET/IPv4/ipfrag_low_thresh
The two files indicate the minimum and maximum memory allocation values used to reorganize IP segments. Once the maximum memory allocation value is reached, other segments are discarded until the Minimum Memory Allocation value is reached.

Default setting: 196608 (ipfrag_low_thresh)
262144 (ipfrag_high_thresh)
2)/proc/sys/NET/IPv4/ipfrag_time
This file indicates how many seconds an IP segment is retained in the memory.
Default Value: 30 seconds)
6.2 Inet peer Storage
1)/proc/sys/NET/IPv4/inet_peer_threshold
An appropriate value of Inet peer memory will be discarded when the threshold value is exceeded. This threshold also determines survival
Time and interval of waste collection. The more entries, the lower the survival period, and the shorter the GC interval.
Default: 65664
2)/proc/sys/NET/IPv4/inet_peer_minttl
The minimum survival period of the entry. At the reorganization end, sufficient fragment is required. This is the lowest
Ensure that the buffer pool volume is smaller than inet_peer_threshold during storage. The value is set to jiffies.
Unit measurement.
Default: 120
3)/proc/sys/NET/IPv4/inet_peer_maxttl
Maximum Retention Period of the entry. After this period is reached, if the buffer pool does not exhaust pressure (for example: slow
The number of entries in the pool is very small). Unused entries will time out. This value is measured in jiffies.
Default: 600
4)/proc/sys/NET/IPv4/inet_peer_gc_mintime
The shortest interval at which garbage collection (GC) passes. This interval will affect the high memory pressure in the buffer pool. This value
Measured in jiffies.
Default settings: 10 http://blog.chinaunix.net/uid-22287947-id-1775633.html

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.