Ubuntu – Improving SSHFS performance when reflecting changes in host directory

mac-osxmountsshsshfsUbuntu

I have an SSHFS mount from a Ubuntu Server VM guest, mounting a host Mac OS X directory. Changes made directly in the Mac OS X host directory take approx 5 – 10 seconds to reflect in the Ubuntu Server VM guest mount.

I am using the following command…

sshfs user@host: ~/host

What additional options (if any) will improve this latency?

Best Answer

SSH is not designed to be a file transfer protocol. SSHFS works by periodically looking at the directory list and caching results.

You can control the caching behavior, but at the cost of performance as it relates to interactivity. If the SSH host you are connecting is accessed via a high latency link, or slow connection, then disabling caching is going to make things browsing the filesystem painful.

Anyway, see the man page, and experiement a bit.

man sshfs

   -o cache=YESNO
          enable caching {yes,no} (default: yes)

   -o cache_timeout=N
          sets timeout for caches in seconds (default: 20)

   -o cache_X_timeout=N
          sets timeout for {stat,dir,link} cache