Almost all kernel modules, including kernel core modules and drivers, provide some configuration files under the /proc/sys file system to provide the properties and behavior of the user adjustment module. Usually a configuration file corresponds to a kernel parameter, the file name is the name of the parameter, and the content of the file is the value of the parameter. We can see all these kernel parameters with the command sysctl -a. The following describes some of the kernel parameters that are more closely related to network programming.
First, some files in the /proc/sys/fs directory
The kernel parameters in the /proc/sys/fs directory are related to the file system. For server programs, the most important of these are the following two parameters:
/proc/sys/fs/fs/file-max, system-level file descriptor limit. Directly modifying this parameter has the same effect as the modification method in "Linux Maximum File Descriptor" (though these are temporary modifications). After modifying /proc/sys/fs/file-max, the application needs to set /proc/sys/fs/inode-max to 3-4 times the value of /proc/sys/fs/fs/file-max, otherwise It may cause the number of i nodes to be insufficient.
Take a look at the system's description of fs.file-max:
/proc/sys/fs/file-max
This file defines a system-wide limit on the Number of open files for all processes. (See also setrlimit(2), which can be used by a process to set the per-process limit,
RLIMIT_NOFILE, on the number of files it may open.) If You get lots of error messages about running out of file handles, try increasing this value:
echo 100000 > /proc/sys/fs/file-max
The kernel constant NR_OPEN imposes an Upper limit on the value that may be placed in file-max.
If you increase /proc/sys/fs/file-max, be sure to increase /proc/sys/fs/inode-max to 3 -4 times the new value of /proc/sys/fs/file-max, or you will run out of inodes.
/proc/sys/fs/epoll/max_user_watches, a user can go to the epoll kernel event The total number of events registered in the table. It refers to the total number of events that all epoll instances opened by the user can listen to, not the number of events that a single epoll instance can listen to. Registering an event into the epoll kernel event table consumes approximately 90 bytes of kernel space on a 32-bit system and 160 bytes of kernel space on a 64-bit system. Therefore, this kernel parameter limits the total amount of kernel memory used by epoll.
Second, some files in the /proc/sys/net directory
The relevant parameters of the network modules in the kernel are located in the /proc/sys/net directory, which is related to the TCP/IP protocol. The parameters are mainly located in the following three directories: core, ipv4, ipv6.
/proc/sys/net/core/somaxconn, which specifies the socket in the listen listener queue that can establish a complete connection and enter the ESTABLISHED state. The maximum number.
/proc/sys/net/ipv4/tcp_max_syn_backlog, specifies the maximum number of sockets that can be moved to the ESTABLISHED or SYN_RCVD state in the listen listener queue.
/proc/sys/net/ipv4/tcp_wmem, which contains three values that specify the minimum, default, and maximum values of the TCP write buffer for a socket.
/proc/sys/net/ipv4/tcp_rmem, which contains three values that specify the minimum, default, and maximum values of the TCP read buffer for a socket.
/proc/sys/net/ipv4/tcp_syncookies, specifies whether to open the TCP sync tag. The sync tag prevents a listener socket from repeatedly receiving connection requests (synchronous segments) from the same address by initiating a cookie, causing the listen listener queue to overflow (so-called SYN storm).
In addition to modifying these system parameters by directly modifying the file, we can also modify them using the sysctl command. Both of these modifications are temporary. The permanent modification is to add the corresponding network parameters and their values in the /etc/sysctl.conf file and execute sysctl -p to make them take effect, just like modifying the maximum number of file descriptors allowed to be opened by the system.
Through the network port bonding (bond) technology, network port redundancy and load balancing can b
Many users who are new to Linux will use the concept of Windows to understand Linux system.
The installation environment is Ubuntu13.10 version i386, the nginx server and mysql server have bee
The Windows 7 and Ubantu dual system are installed on the computer. Since the Linux system
Linux boot management --- systemd uses
Linux learning: find command problem
Ubuntu configuration SSH password-free login
Computer technology: linux remote desktop connection
Detailed configuration of LVM under Linux
How to use rsync for data backup under Linux
Ubuntu Linux environment variable PATH setting
Inux virtual machine network configuration method and solution to the problem
Find the difference between find, locate, whereis, which, type in linux
What configuration is required to play King's Glory on the computer?
New Nexus five manufacturers build built-in Android5.0
Win10IE browser can't open HTML settings IE how to do
What should I do when I use the Edge browser to browse the webpage in the win0 system?
How to keep IE8/9/10 win7 system IE11 shield update prompt method in Win7 system
Let Vista system only recognize the U disk I specified
Win10 Mobile preview version 10536.1004 update and repair content summary
What if the win7 system desktop automatically generates the "My Bluetooth Location" icon
Win10 preview version 10074 frosted glass effect opening method