The modification of the filesystem cache-tuning parameters can significantly improve Linux's file-serving performance up to a factor of two. Linux will attempt to use memory not being used for any other purpose for filesystem caching.
A special daemon, called bdflush, will periodically flush dirty buffers, buffers that contain modified filesystem data or metadata to the disk.
The secret to good performance is to keep as much of the data in memory for as long as is possible. Writing to the disk is the slowest part of any filesystem. If you know that the filesystem will be heavily used, then you can tune this
process for Linux Samba. As with many kernel tuneable options, this can be done on the fly by writing to special files in the /proc filesystem. The trick is, you have to tell Linux you want it to do that. You do so by executing the
following command for a Linux 2.2 kernel.
The default setup for the bdflush parameters under Red Hat Linux is:
"40 500 64 256 500 3000 500 1884 2"
|
To change the values of bdflush, type the following command on your terminal:
Under
[root@deep ] /# echo "80 500 64 64 15 6000 6000 1884 2" >/proc/sys/vm/bdflush
|
You may add the above commands to the
/etc/rc.d/rc.local script file and you'll not have to type it again the next time you reboot your system.
Under
Edit the /etc/sysctl.conf file and add the following line:
# Improve file system performance
vm.bdflush = 80 500 64 64 15 6000 6000 1884 2
|
You must restart your network for the change to take effect. The command to restart the network is the following:
[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 ]
|
This line tells
bdflush not to worry about writing out dirty blocks to the disk until the filesystem buffer cache is 80 percent full (80). The other values tune such things as the number of buffers
to write out in one disk operation (500), how long to allow dirty buffers to age in the kernel (60*HZ), etc. You can find full details in the 2.2 kernel documentation in the file
linux/Documentation/sysctl/vm.txt,
and also, you can check
General System Optimization, for more information.