Linux modifies kernel parameters (/proc/sys and/etc/sysctl.conf) while the system is running, without rebooting the system, which is implemented through the/proc virtual file system.
Most kernel parameters are stored in the/proc/sys directory and are designed to be changed while the system is running, and can be modified to modify kernel parameters by changing the file corresponding to the kernel parameters in/proc/sys (after modification, the save configuration file will automatically take effect immediately), However, the value of the parameter modified before restarting the machine is invalidated, so it can only be a temporary parameter change scheme. (suitable for debugging kernel parameter optimization values, if the setting value is problematic, restart the server to restore the original settings parameter values.) Simple and convenient. )
However, if you need to permanently save the parameter values after debugging kernel parameter optimization values, you must permanently save the changes by modifying the kernel parameters within the/etc/sysctl.conf. But just modify the parameter values in the Sysctl file, confirm that after saving the modified file, set the parameter value will not immediately take effect, if you want to make the parameter value changes immediately effective, and do not restart the server, you can execute the following command:
#sysctl –p
The following is a description of the/proc/sys kernel file and the variables in the configuration file sysctl.conf:
Because kernel parameters that can be modified are in the/proc/sys directory, the sysctl.conf variable name omits the previous section of the directory (/proc/sys).
The conversion of a file in/proc/sys to a variable in Sysctl is based on the following two simple rules:
1. Remove the front part/proc/sys
2. Change the slash in file name to Dot
These two rules can convert any file name in/proc/sys to a variable name in Sysctl.
For example:
/proc/sys/net/ipv4/ip_forward = "Net.ipv4.ip_forward
/proc/sys/kernel/hostname = "Kernel.hostname
You can use the following command to query all modifiable variable names
# Sysctl–a
PS: Now it is rare to write a blog, you are welcome to shoot bricks. If you are free in a few days, try writing a Linux kernel automatic optimization script.
This article is from the "Network" blog, please be sure to keep this source http://netlin.blog.51cto.com/118225/1167446