How to optimize NFS mounts for Trident on OpenShift
Applies to
- OpenShift Container Platform 4.x
- OpenShift Virtualization 4.x
- Trident with NFS-backed StorageClasses
- ONTAP 9 using NFSv4.1 or NFSv4.2 backends
- Red Hat Enterprise Linux CoreOS (RHCOS) worker and control-plane nodes
Description
This article provides baseline tuning guidance for Trident environments that use ONTAP NFS backends on OpenShift and show elevated latency or latency spikes under concurrent workloads, including OpenShift Virtualization workloads.
These settings are baseline recommendations, not universal defaults. Performance depends on workload profile, network topology, and backend configuration.
Apply Steps 1 and 2 as the baseline, re-evaluate performance, and use Step 3 only if workloads still underperform. Validate changes during a maintenance window and adjust as needed for the deployment.
Procedure
- Update the Trident backend or StorageClass mount options to
sec=sys,nconnect=8.- Backend example:
kind: TridentBackendConfig
spec:
nfsMountOptions: sec=sys,nconnect=8 - StorageClass example:
mountOptions:
- sec=sys
- nconnect=8 - If you use the StorageClass method, remove and recreate the StorageClass with the same name.
- Existing pods and VMs do not pick up the change until the PVCs are remounted through restart, stop/start, or live migration.
- Backend example:
- Apply a worker MachineConfig that loads the
sunrpcandnfsmodules and sets the live values.- Set
/sys/module/sunrpc/parameters/tcp_max_slot_table_entriesto128. - Set
/sys/module/nfs/parameters/max_session_slotsto1024. - Wait for the worker pool to finish, then apply the same systemd unit through a control-plane MachineConfig.
- Set
- Monitor the rollout and confirm both pools complete successfully.
oc get mcp worker -w
oc get mcp master -w- Confirm
UPDATED=True,UPDATING=False, andDEGRADED=False.
- Confirm
- Validate the service and live values on an updated node.
oc debug node/<node> -- chroot /host systemctl status nfs-slot-tuning.service --no-pager
oc debug node/<node> -- chroot /host sh -c 'cat /sys/module/sunrpc/parameters/tcp_max_slot_table_entries; cat /sys/module/nfs/parameters/max_session_slots' - Increase the ONTAP SVM setting
-v4.x-session-num-slotsincrementally.- Increase from
180to256,512,768, and then1024. set -privilege advanced
vserver nfs show -vserver <svm_name> -fields v4.x-session-num-slots
vserver nfs modify -vserver <svm_name> -v4.x-session-num-slots <value>
set -privilege admin- Remount or restart affected workloads so new NFSv4.x sessions negotiate the updated slot count.
- Increase from
- Roll back in reverse order if latency regresses.
- Revert Trident mount options to
sec=sys. - Reset ONTAP session slots to
180:set -privilege advanced
vserver nfs modify -vserver <svm_name> -v4.x-session-num-slots 180
set -privilege admin - Delete the worker MachineConfig, wait for completion, then delete the control-plane MachineConfig.
- Revert Trident mount options to
Partner Notes
Additional Information
- Roll out one pool at a time. Do not update worker and control-plane pools concurrently.
- Confirm PodDisruptionBudgets do not block drains before starting.
max_session_slots=1024is the client-side ceiling. ONTAP negotiates down to the lower client/server value for new NFSv4.1 or NFSv4.2 sessions.tcp_max_slot_table_entries=128sets an explicit per-TCP-connection RPC cap. Do not describe it as raising the slot table.- This workflow uses a systemd unit instead of
modprobe.dso the module paths exist and the live values are applied at boot. - ONTAP session-slot changes apply only to newly established NFSv4.x sessions.
- Optionally enable the OpenShift node-exporter mountstats collector to measure client-side NFS activity before and after tuning.
