36

I am a very frequent user of sshfs for mounting various disks over the network. I do however have a very small machine (with an atom processor) from which I need to mount a directory using sshfs.

Is it possible to disable all compression, and perhaps even also encryption when mounting using sshfs, as to limit the cpu usage on the machine from which the directory is mounted?

vava
  • 5,948

6 Answers6

45

Although the high performance ssh adds a none cipher, the arcfour cipher is nearly as fast and is included standard.

Use: -o Ciphers=arcfour

I've been using this over the local network and I get about 85% of 100Mbps Ethernet or about 10.625MB/s

(In response vava's answer, sshfs would still be what it is even when ssh's encryption is off as the authentication protocol would still be active without which you might as well be using telnet.)


Note for @osgx I recently found OpenSSL: Cipher Selection which includes the following graph:

enter image description here

The following is the results section from that page. The graph and the results are questionable as they don't state how the benchmark was done and on what hardware but I think that they aren't that far off.

100,000 Kbyte/s is my threshold for acceptable performance. This represents 1 CPU core (of 8 in my case) running at 100% utilization to transfer 780Mbit/s of data (which is a reasonable saturation point for a gigabit Ethernet link).

RC4 is the fastest cipher, if you are using a processor which does not support AESNI.

AES-128 is the next fastest cipher, and much faster than RC4 if you have AESNI support. It’s about 54% slower if you don’t. AES-256 is slower still, and unless explicitly configured otherwise, any browser that supports AES-128 will also support AES-256.

What has been quoted above clearly shows that arcfour (and also AES with AESNI) can saturate a Gigabit link on a modern machine.

If you don't need encryption, the none cipher from hpn-ssh is even faster but you would only need it if you need to saturate a link with several times the bandwidth of a Gigabit link or if you need reduced CPU usage.

Dan D.
  • 6,342
13

For sftp with no encryption, use sshfs + socat

On the server side run

socat TCP4-LISTEN:7777 EXEC:/usr/lib/sftp-server

And on the client side

sshfs -o directport=7777 remote:/dir /local/dir

Source: http://pl.atyp.us/wordpress/index.php/2009/09/file-transfer-fun/

endru
  • 131
3

There is no way to disable encryption - this is ssh after all. And it looks like compression is disabled by default as you have to request it with the -C switch.

But you may want to check your ~/.ssh/config file for settings regarding compression. If you add the following lines at the top of that file, compression should be disabled:

Host *
    Compression no
innaM
  • 10,412
2

You can mount with -o compression=no to turn the compression off. It is not possible to turn encryption off, wouldn't be sshfs after that :) If it is slow I suggest to use other way to mount a directory, like through samba, nfs or ftp.

vava
  • 5,948
1

I think compression is something that is really only quicker if the time to compress is compensated for by the time to transfer data. So compression on a slow connection is increasing speed up to maybe 6 times faster than without. Compression on a fast connection is not useful at all, as it drops speed due to compression delay on your or the host system. Some hosts don't accept compression at all, as they don't want to spend processor power on users.

I think this switch -o Ciphers=arcfour will increase the speed of encryption to nearly no encryption, and -o cache=yes -o kernel_cache -o large_reads -o compression=no may increase your speed a lot as it optimises sshfs a bit. Compression on low speed connections will speed up your transfer a lot if compression is possible; mostly it is. For example I do use it with a 2 Mbit/s down and 0,3 Mbit/s up connection, and it speeds up the transfer by about 3-5 minutes instead of 25-30 minutes for about 30 MByte.

Blackwood
  • 3,184
0

since the answer from @endru fails on recent systems with

failed to resolve ubuntu@otherhost.lan:7777: Temporary failure in name resolution

and the example only allows one connection:

  • Server socat TCP4-LISTEN:7777,fork,reuseaddr EXEC:/usr/lib/sftp-server

  • Client mkfifo /tmp/sshreturn;cat /tmp/sshreturn |sshfs -o slave,reconnect,cache=yes,kernel_cache,compression=no,allow_other,ServerAliveInterval=45,ServerAliveCountMax=2,reconnect,noatime ubuntu@192.168.254.254:/my/folder /tmp/folder | socat STDIO tcp:192.168.254.254:7777 > /tmp/sshreturn