Tuning NFS client read ahead on SLE 10 and 11

This document (7003356) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10 Service Pack 2
SUSE Linux Enterprise Desktop 11
SUSE Linux Enterprise Desktop 10 Service Pack 2

Situation

How is NFS client read-ahead tuned on SLE 10 and 11?

Resolution

SLES 11:

In SLES 11, the tunable is present at:
/sys/class/bdi/X:Y/read_ahead_kb
 
Note that this is tunable *after* the file system is mounted.  "X:Y" is variable, although with NFS it will typically be 0:something.  Normally "backing devices" are block device. But for NFS, a synthetic "backing device" is created to store these parameters.  In that case the 'X' is 0, and the 'Y' is some random number.
 
If a particular NFS mount used "0:18", then the place to tune the read ahead for that mount would be:
/sys/class/bdi/0:18/read_ahead_kb
 
The system can tell you what the 0:n number through:
stat -c '%d' /mount/point
 
In theory, a script could be used to inspect and set the read_ahead_kb for a given file system.  Here's a possible example, called set-ra.sh:
 
#!/bin/sh
# usage: To display current value: set-ra.sh </mount/point>
# To set a new value: set-ra.sh </mount/point> <new_value>
 
case $# in
   1) cat /sys/class/bdi/0:`stat -c '%d' "$1"`/read_ahead_kb
   ;;
   2) echo $2 > /sys/class/bdi/0:`stat -c '%d' "$1"`/read_ahead_kb
   ;;
esac
#----------end-------------
 
This script is just an example, it is not highly tested.
 
 
SLES 10 SP2:

On SLES 10 SP2, the live value is stored at /proc/sys/fs/nfs/nfs_max_readahead

For dynamic tuning, set it with (i.e. if 32 is the desired value):
echo 32 > /proc/sys/fs/nfs/nfs_max_readahead
 
This tunable only takes effect if it is in place before the mount is done. So to put this into effect dynamically, you'd need something in the order of:
 
umount
tune
mount
 
This could also be set at boot, before /etc/fstab mounts are done, by editing /etc/sysctl.conf and adding:
fs.nfs.nfs_max_readahead = 20
 
However, if the system is not up-to-date, this might not come into effect during boot, due to timing issues between sysctl and nfs initialization.  Without current updates (May 2009), the following may be needed after boot:
sysctl -p
rcnfs restart

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7003356
  • Creation Date: 26-May-2009
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback@suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center