Optimizing Kiosk Infrastructure: NFS vs. Local Sync for /home Directory Performance


2 views

When deploying kiosk systems with minimal local storage, the home directory management becomes critical. Two primary approaches emerge:

  1. NFS-mounted /home directory
  2. Local copy synchronized via rsync

For NFS deployment, here's a sample /etc/exports configuration:


# Server-side exports configuration
/home 192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)

Client-side mounting in /etc/fstab:


nas-server:/home /home nfs rw,hard,intr,noatime 0 0
Operation NFS Latency Local SSD
1MB file read 12ms 2ms
Directory listing (500 files) 45ms 8ms

For environments where NFS performance is unacceptable, consider this login/logout script:


#!/bin/bash
# ~/bin/sync_home.sh
SERVER="backup-server"
USER=$(whoami)

case $1 in
  login)
    rsync -az --delete ${SERVER}:/home/${USER}/ /home/${USER}/
    ;;
  logout)
    rsync -az --delete /home/${USER}/ ${SERVER}:/home/${USER}/
    ;;
esac
  • Implement QoS rules prioritizing NFS traffic (DSCP 46)
  • Use jumbo frames (MTU 9000) on dedicated VLAN
  • Consider NFSv4.1 with pNFS for parallel access

In our 50-kiosk deployment at a university library, we used:


# NFS server tuning
echo 32768 > /proc/sys/net/core/rmem_max
echo 32768 > /proc/sys/net/core/wmem_max
echo 10 > /proc/sys/net/ipv4/tcp_syn_retries

When deploying kiosk systems with minimal local storage (boot from USB), engineers face a critical architectural decision: whether to host user home directories on NFS or implement a local sync mechanism. This choice impacts performance, reliability, and maintenance overhead.

For NFS-mounted home directories, the server configuration requires careful tuning:

# /etc/exports configuration example
/home/kiosk_users 192.168.1.0/24(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000)

Client-side mounting should include these optimizations:

# /etc/fstab entry
fileserver:/home/kiosk_users /home nfs rw,hard,intr,noatime,nodev,nosuid,tcp 0 0

The rsync-based approach requires login/logout hooks:

# /etc/profile.d/sync_home.sh
if [ -n "$SSH_CONNECTION" ]; then
    rsync -az --delete fileserver:/home/kiosk_users/$USER/ $HOME/
fi

# /etc/bash.bash_logout
rsync -az --delete $HOME/ fileserver:/home/kiosk_users/$USER/

Our tests on 100MB test files showed:

Operation NFS (ms) Local Sync (ms)
File Read 420 85
File Write 510 120
Directory Scan 350 45

Monitoring showed NFS generates continuous small packets (50-100KB/s baseline), while rsync creates bursts (5-10MB during sync periods). For 50 kiosks:

  • NFS: ~5Mbps constant load
  • Rsync: 50Mbps peaks during login/logout

NFS solutions must handle:

# Auto-reconnect script
*/5 * * * * root /bin/mount -a | grep -q '/home' || (umount -l /home && mount /home)

For rsync, implement local caching:

#!/bin/bash
# Emergency local mode
if ! ping -c1 fileserver; then
    cp -a /home/fallback/$USER/ $HOME/
fi

Choose based on your environment:

  • NFS: Stable networks, large home directories, many small files
  • Local Sync: Unreliable networks, bursty usage patterns, media-heavy content