Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Optimizing Samba Performance

Samba performs excellently, so performance usually isn't an issue. If performance becomes an issue, there are several options to evaluate.

Samba's defaults yield excellent performance. However, the Samba 2.0.7 default is level2 oplocks=no. You can substantially boost performance of a share whose primary file access is read, and that has little write contention, by setting it to yes.

Level 2 oplocks are an opportunistic locking mechanism enabling the file to be cached, for read access, on the client. This greatly decreases traffic over the wire. However, if even one client requests write access for the file, all the clients must reread the file.

Make sure to retain the default oplocks=yes unless files are edited directly on the UNIX box, in which case the client caching would result in a versioning problem. You should also turn off oplocks on unstable networks, but most Linux/Samba served networks are extremely stable.

Modern Samba versions, including the one shipped with Red Hat 7, default to wide links=yes. It is slightly more secure to set this to no, but setting it to no creates a substantial performance decrease. To minimize that decrease, be sure that getwd cache=yes, which is already the default. The combination of wide links=no and getwd cache=no significantly reduces performance.

Last but not least, the smb.conf shipping with Red Hat 7 contains the following parameter:

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

Unless you have a specific reason to do otherwise, the preceding should be the setting of the socket options= parameter on Red Hat 7 Samba servers.

Tweaks to virtual memory utilization may also improve Samba performance by tuning Linux to optimally handle Samba. Two tweaks specifically have been documented.


   # echo "80 500 64 64 80 6000 6000 1884 2" >/proc/sys/vm/bdflush


   # echo "60 80 80" >/proc/sys/vm/buffermem

Some other possible enhancement techniques include faster network hardware and wiring, a better server hard disk, more server memory, or a server CPU upgrade.

The bottom line is that performance is bottleneck-limited, so to improve performance, it's essential to locate the performance bottleneck. A performance enhancement plan can be made once that's done. Until the bottleneck is located, speculation makes little sense.

One of the best bottleneck analysis techniques is deliberately slowing a suspected bottleneck. If system throughput slows proportionately, you've found a bottleneck. If system throughput slows only slightly, continue looking.

Share ThisShare This

Informit Network