Linuxtcp/ip tuning parameters

Source: Internet
Author: User
All the TCP/IP tuning parameters of linuxtcp/ip are in the/proc/sys/net/directory. for example, the following are some of the most important optimization parameters, which are followed by their meanings: www.2cto. com1./proc/sys/net/core/rmem_max & mdash; maximum TCP data receiving buffer 2...
Linux TCP/IP tuning parameters all TCP/IP tuning parameters are in the/proc/sys/net/directory. for example, the following are some of the most important optimization parameters, which are followed by their meanings: www.2cto.com 1. /proc/sys/net/core/rmem_max-maximum TCP data receiving buffer 2. /proc/sys/net/core/wmem_max-maximum TCP data sending buffer 3. /proc/sys/net/ipv4/tcp_timestamps-add 12 bytes to the TCP header (see RFC 1323). 4. /proc/sys/net/ipv4/tcp_sack-select a response. /proc/sys/net/ipv4/tcp_window_scaling-support for larger TCP windows. if the maximum number of TCP windows exceeds 65535 (64 K), you must set this value to 1 6. rmem_default- Default receiving window size 7. rmem_max-maximum size of the receiving Window 8. wmem_default-default sending window size 9. wmem_max-the maximum size of the sending window www.2cto.com/proc directory is temporary, so any modifications will be lost after the system is restarted. we recommend that you automatically modify the TCP/IP parameters when starting the system: add the following code to/etc/rc. local file, and then save the file. when the system restarts, the following TCP/IP parameters will be automatically modified: echo 256960>/proc/sys/net/core/rmem_default echo 256960>/proc/sys/net/core/rmem_max echo 256960>/proc/sys/net/core/wmem_default echo 256960>/proc/sys/net/core/wmem_max echo 0>/proc/sys/net/ipv4/tcp_timestamps echo 1>/proc/sys/net/ipv4/tcp_sack echo 1>/proc/sys/net/ipv4/tcp_window_scaling TCP/ IP parameters are self-explanatory, the TCP window size is set to 256960, and the TCP timestamp is disabled (12 bytes are removed from the header of each data packet). the larger TCP window and the selected response of TCP are supported. The above value is determined based on the internet connection and the maximum bandwidth/latency rate. note: the value in the above instance can be used in practice, but it only contains some parameters. another method: Use/etc/sysctl. when the system starts, conf configures the parameter to the value you set: net. core. rmem_default = 256960. net. core. rmem_max = 256960. net. core. wmem_default = 256960. net. core. wmem_max = 256960. net. ipv4.tcp _ timestamps = 0 net. ipv4.tcp _ sack = 1 net. ipv4.tcp _ window_scaling = 1 www.2cto.com --------------------------------------------------------------/proc/sys/fs/sup Er-max this file specifies the maximum number of super block processors. Super block is required for any mounted file system. Therefore, if a large number of mounted file systems are installed, the super block processing program may be used up. Default setting: 256/proc/sys/fs/super-nr. this file displays the number of allocated super blocks. This file is read-only and only used to display information. /Proc/sys/kernel/acct this file has three configurable values, based on the number of available space on the file system containing logs (expressed in percentage ), these values control when process accounting starts: if the available space is lower than this percentage value, stop the process accounting if the available space is higher than this percentage value, start Process accounting check the frequency of the above two values (in seconds) to change a value of this file, should return a string of numbers separated by spaces. Default setting: 2 4 30 www.2cto.com. if the file system containing logs only has less than 2% of the available space, these values will stop accounting. if there is 4% or more available space, start billing again. Check every 30 seconds. /Proc/sys/kernel/ctrl-alt-del the file has a binary value that controls how the system reacts when receiving the ctrl + alt + delete combination. The zero (0) value indicates capturing ctrl + alt + delete and sending it to the init Program. This allows the system to be shut down and restarted perfectly, just as if you entered the shutdown command. The value 1 indicates that ctrl + alt + delete is not captured, and non-clean shutdown will be executed, as if the power is directly turned off. Default setting: 0/proc/sys/kernel/domainname. this file allows you to configure the Network domain name. It does not have the default value. it may have already set the domain name, or it may not have been set. /Proc/sys/kernel/hostname this file allows you to configure the network host name. It does not have a default value, maybe the host name has been set, or maybe not. /Proc/sys/kernel/msgmax this file specifies the maximum length 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 increased, the memory used by the operating system is increased. Default value: 8192/proc/sys/kernel/msgmnb. this 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 IDs. Default settings: 16 www.2cto.com/proc/sys/kernel/panic. this file indicates that if "kernel panic" occurs )", the waiting time (in seconds) of the kernel before the reboot ). Zero (0) seconds will disable reboot in the event of a serious kernel error. Default setting: 0/proc/sys/kernel/printk. the file has four numeric values, which define where to send messages based on the importance of logging messages. For more information about different log levels, see the online help page of syslog (2. The four values of this file are: Console log level: messages with a higher priority will be printed to the default message log level on the console: this priority will be used to print the console log level with the lowest priority for messages without the highest priority: the minimum value (highest priority) that can be set for the console log level default console log level: default settings for log level in the console: 6 4 1 7/proc/sys/kernel/shmall the total amount of shared memory that can be used by the system at any given time point (in bytes ). Default setting: 2097152/proc/sys/kernel/shmax this file specifies the maximum size of shared memory segments allowed by the kernel (in bytes ). Default setting: 33554432/proc/sys/kernel/shmmni. this file indicates the maximum number of shared memory segments used by the entire system. Default setting: 4096/proc/sys/kernel/sysrq. if the specified value of this file is non-zero, the System Request Key is activated. Default value: 0/proc/sys/kernel/threads-max. this file specifies the maximum number of threads that the kernel can use. Default settings: 2048/proc/sys/net www.2cto.com/proc/sys/net/core/message_burst time required to write a new warning message (in 1/10 seconds ); other warning messages received during this time will be discarded. This is used to prevent Denial of Service (Denial of Service) attacks by certain people who attempt to "flood" your system with messages. Default setting: 50 (5 seconds)/proc/sys/net/core/message_cost This file contains cost values related to 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 that when the interface receives packets faster than the kernel processes these packets, the maximum number of data packets that can be sent to the queue. Default setting: 300/proc/sys/net/core/optmem_max this file specifies the maximum buffer size allowed by each socket. /Proc/sys/net/core/rmem_default this file specifies the default value of the buffer size of the received socket (in bytes ). /Proc/sys/net/core/rmem_max this file specifies the maximum buffer size of the received socket (in bytes ). /Proc/sys/net/core/wmem_default this file specifies the default value of the buffer size of the sending socket (in bytes ). /Proc/sys/net/core/wmem_max this file specifies the maximum buffer size of the sending socket (in bytes ). All ipv4 and IPv6 parameters of/proc/sys/net/IPv4 are recorded in the kernel source code documentation. See the file/usr/src/linux/Documentation/networking/ip-sysctl.txt. /Proc/sys/net/ipv6 is the same as IPv4. /Proc/sys/vm/buffermem this file controls the total number of system memory used for buffer memory (expressed as a percentage ). It has three values. you can set these values by writing a string of numbers separated by spaces to the file. The minimum percentage of memory used for the buffer. if there is not much system memory left and the system memory is decreasing, the system will try to maintain the number of buffer memory. Maximum percentage of memory used by www.2cto.com for the buffer zone default setting: 2 10 60/proc/sys/vm/freepages how the file control system handles various levels of available memory. It has three values. you can set these values by writing a string of numbers separated by spaces to the file. If the number of available pages reaches the minimum limit, only the kernel is allowed to allocate some memory. If the number of available pages in the system is lower than this limit, the kernel starts the swap in a more active way to release the memory to maintain system performance. The kernel will try to keep this amount of system memory available. If the value is lower than this value, kernel switching will be started. Default settings: 512 768 1024/proc/sys/vm/kswapd this file controls how the kernel can swap memory. It has three values. by writing a string of numbers separated by spaces to the file, you can set these three values: the maximum number of pages released by the kernel upon trial. This value is required if you want to increase the bandwidth during memory swap. The minimum number of times the kernel tries to release the page during each switch. Number of pages written by the kernel in one swap. This has the greatest impact on system performance. The larger the value, the more data is exchanged, and the less time it takes to track the disk. However, this value is too large to be "overwhelmed" by the request queue, which in turn affects system performance. Default settings: 512 32 8/proc/sys/vm/pagecache the file works the same way as/proc/sys/vm/buffermem, but it is for file memory ING and general high-speed cache. Www.2cto.com makes kernel settings persistent. a convenient 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 redirection methods used above), but it also has a configuration file that is executed during system boot. This allows you to change the running kernel and add these changes to the configuration file so that these changes take effect after the system is rebooted. This utility is called sysctl. on the online help page of sysctl (8), complete documentation is provided for this utility. The sysctl configuration file is/etc/sysctl. conf. you can edit the file and record it under sysctl. conf (8. Sysctl treats files in/proc/sys as a single variable that can be changed. Therefore, taking the file/proc/sys/fs/file-max in/proc/sys as an example, it indicates the maximum number of file handles allowed in the system, this file is represented as fs. file-max. This example reveals some wonderful things in sysctl notation. Because sysctl can only change the variables in the/proc/sys directory, and people always think that the variables are under this directory, the part of the variable name (/proc/sys) is omitted ). Another note is to change the directory separator (forward slash/) to a period (dot.) in English .). There are two simple rules to convert files in/proc/sys to variables in sysctl: remove the previous section/proc/sys. Change the forward slash in the file name to a vertex. These two rules allow you to convert any file name in/proc/sys to any variable name in sysctl. Generally, the conversion from a file to a variable is: www.2cto.com/proc/sys/dir/file --> dir. file dir1.dir2. file -->/proc/sys/dir1/dir2/file you can use the command sysctl-a to view all the variables that can be changed and their current settings. You can also use sysctl to change the variable, which performs exactly the same work as the echo method used above. The representation is: sysctl-w dir. file = "value" or use file-max as an example. use one of the following two methods to change the value to sharp2wing, author of 16384.

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.