Part 4: System Optimization
/proc file systems
The /proc and /sys sudo file systems, and how these file systems are used by the Linux kernel to keep current status information.
- Performance analyzing tools mine the contents of the proc file system.
- Every process has a file in the PID directory
/proc/sys
fs
kernel
net
vm
Notes on sysctl
sysctl settings are defined through files in
/usr/lib/sysctl.d/
/run/sysctl.d/
/etc/sysctl.d/ <– Custom config
Vendors settings in /usr/lib/sysctl.d/.
sysctl -a
Output of tunable.
sysctl -w <setting>
Run time setting change
sysctl -p
Reloads configuration files
To override a whole file, create a new file with the same in
/etc/sysctl.d/ and put new settings there. Edit /etc/sysctl.conf to load custom settings too.
To override specific settings, add a file with a lexically later name in /etc/sysctl.d/ and put new settings there.
For more information, see sysctl.conf(5) and sysctl.d(5).
Change values on the command-line before making persistent.
Example: (reduce swappiness)
cd /proc/sys/vm
echo 10 > swappiness