Linux/proc/sys

Source: Internet
Author: User
Tags message queue

All TCP/IP tuning parameters are located in the/proc/sys/net/directory. For example, here are some of the most important tuning parameters, followed by their meanings:

  1,/proc/sys/net/core/rmem_max -the largest TCP data receive buffer

  2,/proc/sys/net/core/wmem_max -the largest TCP data send buffer

3,/proc/sys/net/ipv4/tcp_timestamps -timestamp in (please refer to RFC 1323) TCP header increased by 12 bytes

  4./proc/sys/net/ipv4/tcp_sack -Selective response

  5,/proc/sys/net/ipv4/tcp_window_scaling -support for larger TCP windows. If the TCP window is greater than 65535 (64K), the value must be set to 1

  6, Rmem_default -default Receive window size

7,Rmem_max -The maximum size of the receiving window

8.Wmem_default -Default Send window size

9. Wmem_max -Maximum size of the sending window

icmp_destunreach_rate, Icmp_echoreply_rate, Icmp_paramprob_rate, icmp_timeexeed_rate: Sets the rate of the maximum ICMP packets sent and responded to, preferably not for 0;

icmp_echo_ignore_all and icmp_echo_ignore_broadcasts: Set the kernel does not answer ICMP Echo packet, or the specified broadcast, a value of 0 is allowed to respond, a value of 1 is forbidden;

Ip_default_ttl: Set the default Time to Live (TTL) of the IP packet, and increase its value can reduce the system overhead;

Ip_forward: Set whether the interface can be forwarded, the default is 0, set to 1 to allow the network packet forwarding;

Ip_local_port_range: Specifies the TCP or UDP port range when a port is required locally. The first number is the low port, the second number is the high port;

tcp_syn_retries: provides a limit on the number of SYN packets that are sent to resend a response when a connection is established;

tcp_retries1: sets the number of times the response is connected to the re-send, by default 3;

tcp_retries2: Sets the number of TCP packets that are allowed to be re-sent by default of 15.

/proc/sys/fs/super-max

This file specifies the maximum number of Super block handlers. Any mounted file system requires the use of a super block, so if you mount a large number of file systems, you might run out of super block handlers.

Default setting: 256

  /proc/sys/fs/super-nr

The file shows the number of currently allocated super blocks. The file is read-only and is used only to display information.

/Proc/sys/kernel

  /proc/sys/kernel/acct

The file has three configurable values, depending on the amount of free space on the file system that contains the log (expressed as a percentage), which controls when process accounting begins:

Stop process Accounting If free space falls below this percent value

Start process Accounting If free space is above this percent value

Check the frequency of the above two values (in seconds)

To change a value for this file, you should echo a string of numbers separated by a space.

Default setting: 2 4 30

If there is less than 2% free space on the file system that contains the log, these values cause accounting to stop, and if there is 4% or more free space, the accounting is started again. Do a check every 30 seconds.

/Proc/sys/kernel/ctrl-alt-del

The file has a binary value that controls how the system reacts when it receives the Ctrl+alt+delete key combination. These two values indicate:

A value of 0 (0) indicates that the Ctrl+alt+delete is captured and sent to the INIT program. This will allow the system to shut down and reboot perfectly as if you had entered the shutdown command.

One (1) value indicates that the Ctrl+alt+delete is not captured and will perform a non-clean shutdown as if the power is being turned off.

Default setting: 0

  /proc/sys/kernel/domainname

This file allows you to configure the network domain name. It does not have a default value, perhaps the domain name has been set, perhaps not set.

  /proc/sys/kernel/hostname

This file allows you to configure the network host name. It does not have a default value, perhaps the hostname has been set, or it may not be set.

  /proc/sys/kernel/msgmax

This file specifies the maximum length of messages sent from one process to another. Inter-process messaging is done in the kernel's memory and is not swapped to disk, so increasing the value increases the amount of memory used by the operating system.

Default setting: 8192

  /proc/sys/kernel/msgmnb

The file specifies the maximum number of bytes in a message queue.

Default setting: 16384

  /proc/sys/kernel/msgmni

This file specifies the maximum number of message queue identities.

Default setting: 16

  /proc/sys/kernel/panic

This file indicates the time (in seconds) that the kernel waits before rebooting if "kernel Critical error (Kernel panic)" occurs. 0 (0) seconds The reboot is disabled when a kernel critical error occurs.

Default setting: 0

 /proc/sys/kernel/printk

The file has four numeric values that define where to send it, based on the importance of logging messages. For more information about the different log levels, read the Syslog (2) online help page. The four values for this file are:

Console log level: Messages with priority above this value will be printed to the console

Default Message Log level: This priority will be used to print messages with no priority

Lowest console Log level: Minimum value (highest priority) at which the console log level can be set

Default console Log level: Default value for the console log level

Default setting: 6 4 1 7

  /proc/sys/kernel/shmall

The file is the total amount of shared memory (in bytes) that can be used on the system at any given moment.

Default setting: 2097152

  /proc/sys/kernel/shmax

This file specifies the size, in bytes, of the maximum shared memory segment allowed by the kernel.

Default setting: 33554432

  /proc/sys/kernel/shmmni

This file represents the maximum number of shared memory segments for the entire system.

Default setting: 4096

  /proc/sys/kernel/sysrq

If the file specifies a value other than zero, the System Request Key is activated.

Default setting: 0

  /proc/sys/kernel/threads-max

This file specifies the maximum number of threads that the kernel can use.

Default setting: 2048

/proc/sys/net

  /proc/sys/net/core/message_burst

The time, in 1/10 seconds, that is required to write a new warning message, and the other warning messages received during this time are discarded. This is used to prevent some attempts to "overwhelm" the denial of service (denial of services) attacks used by people who are using the message "drown" your system.

Default setting: 50 (5 seconds)

  /proc/sys/net/core/message_cost

The file has cost values associated with each warning message. The larger the value, the more likely it is to ignore the warning message.

Default setting: 5

 /proc/sys/net/core/netdev_max_backlog

This file specifies the maximum number of packets that are allowed to be sent to the queue when the rate at which the interface receives packets is faster than the rate at which the kernel processes these packets.

Default setting: 300

  /proc/sys/net/core/optmem_max

This file specifies the size of the maximum buffer allowed for each socket.

  /proc/sys/net/core/rmem_default

The file specifies the default value, in bytes, to receive the socket buffer size.

  /proc/sys/net/core/rmem_max

The file specifies the maximum value, in bytes, of the receive socket buffer size.

 /proc/sys/net/core/wmem_default

The file specifies the default value (in bytes) for the send socket buffer size.

  /proc/sys/net/core/wmem_max

The file specifies the maximum size, in bytes, of the send socket buffer.

  /proc/sys/vm

/proc/sys/vm/buffermem

This file controls the total amount of system memory used for buffer memory, expressed as a percentage. It has three values and sets these three values by writing a string of numbers separated by a space.

The minimum percentage of memory used for buffers

If the remaining system memory is not large and system memory is decreasing, the system will attempt to maintain the amount of buffer memory.

Maximum percentage of memory used for buffers

Default setting: 2 10 60

/proc/sys/vm/freepages

This file controls how the system handles various levels of available memory. It has three values and sets these three values by writing a string of numbers separated by a space.

If the number of available pages in the system reaches the minimum limit, only the kernel is allowed to allocate some memory.

If the number of available pages in the system falls below this limit, the kernel will initiate the interchange in a more aggressive manner to free up memory, thereby maintaining system performance.

The kernel will try to keep this amount of system memory available. Below this value will start the kernel exchange.

Default setting: 512 768 1024

/proc/sys/vm/kswapd

This file controls how the kernel is allowed to swap memory. It has three values and sets these three values by writing a string of numbers separated by a space to the file:

The maximum number of pages that the kernel attempted to release at one time. If you want to increase the bandwidth in the memory exchange process, you need to increase the value.

The minimum number of times the kernel attempted to free a page in each interchange.

The number of pages written by the kernel in a single interchange. This has the greatest impact on system performance. The larger the value, the more data is exchanged, and the less time is spent on the disk seek. However, this value is too general for the "flooded" request queue and in turn affects system performance.

Default setting: 512 32 8

/proc/sys/vm/pagecache

The file is the same as/proc/sys/vm/buffermem's work, but it is a memory-mapped and general cache for the file.

Make Kernel settings persistent

A handy utility is provided to change any kernel parameters in the/proc/sys directory. It allows you to change the running kernel (similar to the Echo and redirect methods used above), but it also has a configuration file that executes at system boot time. This allows you to change the running kernel and add those changes to the configuration file so that the changes will still take effect after the system reboots.

The utility is called SYSCTL and is fully documented in the online help page of Sysctl (8). The Sysctl configuration file is/etc/sysctl.conf, which can be edited and recorded under Sysctl.conf (8). Sysctl treats the file under/proc/sys as a single variable that can be changed. So, as an example of file/proc/sys/fs/file-max under/proc/sys, it represents the maximum number of file handles allowed in the system, and this file is represented as Fs.file-max.

This example reveals some of the fantastic things about sysctl notation. Since sysctl can only change variables in the/proc/sys directory, and people always think that variables are in this directory, the part of the variable name is omitted (/proc/sys). Another change to illustrate is to replace the directory delimiter (forward slash/) with a period (point) in English.

There are two simple rules for converting files in/proc/sys to variables in sysctl:

Remove the front part of the/proc/sys.

Changes a forward slash in the file name to a point.

These two rules enable you to convert any of the file names in/proc/sys to any of the variable names in Sysctl. The general file-to-variable conversion is:

/proc/sys/dir/file-Dir.file

Dir1.dir2.file-/proc/sys/dir1/dir2/file

You can use the command sysctl-a to view all variables and their current settings that you can change.

You can also change a variable with sysctl, which works exactly like the Echo method used above. Its notation is:

Sysctl-w dir.file= "Value"

or using File-max as an example, use one of the following two methods to change the value to 16384.

Linux/proc/sys

Related Article

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.