I'm trying to make a persistent change to sunrpc.tcp_slot_table_entries on a Linux CentOS 5.5. This value has been found important for the performance of our NFS clients, and must be set before the NFS mounts are done.

Simply putting the value in /etc/sysctl.conf doesn't work because /etc/rc.d/rc.sysinit (which does the sysctl -p) is executed before the sunrpc module is loaded.

Same problem with RHEL 4:

I tried to:

  • put install sunrpc /sbin/modprobe -q --ignore-install sunrpc;/sbin/sysctl -w sunrpc.tcp_slot_table_entries=64 in /etc/modprobe.conf (and in /etc/modprobe.d/sunrpc)
  • put SUBSYSTEM=="module" ACTION=="add" DEVPATH=="*/sunrpc" RUN+="/sbin/sysctl -w sunrpc.tcp_slot_table_entries=64" (maybe it has to be changed for CentOS 5) in /etc/udev/rules.d/23-sunrpc.rules but to no avail.

And I'd prefer not to modify /etc/init.d/netfs (from initscripts package).

So, have you succeeded in doing it properly on a CentOS 5, and if so, how ?

Edit: found in /etc/modprobe.d/modprobe.conf.dist:

install sunrpc /sbin/modprobe --first-time --ignore-install sunrpc && { /bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1 || :; }

That's maybe why my own addition to modprobe wasn't taken into account. But I'm not sure if I should modify directly that file, as it may be overwritten by module-init-tools updates ...

link|improve this question
feedback

3 Answers

You could put /sbin/sysctl -w sunrpc.tcp_slot_table_entries=64 in /etc/rc.d/rc.local.

link|improve this answer
# This script will be executed *after* all the other init scripts. so it's not useful as sysctl will be done after the NFS mounts, and the setting won't be taken into account. – David142 Sep 28 '10 at 7:08
feedback
up vote 0 down vote accepted

Finally I created an almost dummy init script, inserted at S15 (see in /etc/rc3.d/), as the module is loaded in S14 (nfslock) and used in S25 (netfs).

/etc/init.d/sunrpc_tuning:

#!/bin/sh
#
# sunrpc_tuning       Tunes /proc/sys/sunrpc (launched after lockd)
#
# chkconfig: 345 15 85
# description: set values to sunrpc after module is loaded
# probe: true

case "$1" in
   start)
      echo "Setting sunrpc.tcp_slot_table_entries ..."
      /sbin/sysctl -w sunrpc.tcp_slot_table_entries=128
      ;;
   *) ;;
esac

Then: chkconfig --add sunrpc_tuning

link|improve this answer
feedback

I'm running RHEL5.4, and it seems that somehow the sysctl.conf settings are being applied (somehow?) before netfs mounts volumes. How did you verify this?

I modified the netfs initscript, to write the sunrpc.tcp_slot_table_entries value before nfs mounts were actioned, and it wrote out '128' vs the default '16'.

  start)
    # Let udev handle any backlog before trying to mount file systems
    /sbin/udevsettle --timeout=30
    [ -n "$NFSFSTAB" ] &&
      {
        [ ! -f /var/lock/subsys/portmap ] && service portmap start
 /sbin/sysctl sunrpc.tcp_slot_table_entries >> /tmp/sunrpc
        action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4
link|improve this answer
actually, sysctl is called in /etc/rc.d/rc.sysinit, which is executed before any runlevel initscripts get run, so I'm not sure why you have to do what you're doing here... – jau Nov 2 '11 at 14:05
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.