Securing and Optimizing Linux: RedHat Edition -A Hands on Guide | ||
---|---|---|
Prev | Chapter 6. Linux General Optimization | Next |
The buffermem file is also closely related to the operation of the virtual memory VM subsystem of the Linux kernel. The value in this file /proc/sys/vm/buffermem controls how much memory should be used for buffer memory in percentage. It is important to note that the percentage is calculated as a percentage of total system memory.
The default setup for the buffermem parameters under Red Hat Linux is: "2 10 60"
[root@deep] /# echo "70 10 60" >/proc/sys/vm/buffermem |
# Improve virtual memory performance vm.buffermem = 70 10 60 |
[root@deep] /# /etc/rc.d/init.d/network restart |
Setting network parameters [ OK ] Bringing up interface lo [ OK ] Bringing up interface eth0 [ OK ] Bringing up interface eth1 [ OK ]
According to the /usr/src/linux/Documentation/sysctl/vm.txt file, the first parameter 80 % means to use a minimum of 80 percent of memory for the buffer cache; the minimum percentage of memory that should be spent on buffer memory.The last two parameters 10 and 60 are unused by the system so we dont need to change the defaults.Depending of the amount of RAM you have in the server the value of 80% may vary. When your server is highly loaded and when all application are used, you can know in detail how much memory are required and used by the system. 80 % for the buffermem parameters seem to be too much for systems under 256 MB of RAM. Doing a free -m command on the prompt your system will display amount of free and used memory in the system. Once you have executed this command free -m, check for -/+ buffers/cache:values and get the one related to the minimal (-) to set your value for buffermem.
Example 6-1. For 128 MB of RAM
128 * 80% = 102.4 MB 128 - 102.4 = 25.6 MB |
[root@deep] /#free -m |
total used free shared buffers cached Mem: 124 121 3 30 43 48 -/+ buffers/cache: 29 95 Swap: 128 2 126 |
128 * 70% = 89.6 128 - 89.6 = 38.4 MB |
: Look at /usr/src/linux/Documentation/sysctl/vm.txt for more information on how to improve kernel parameters related to virtual memory.