Solved Slow scp only from external -> FreeBSD

I'm running FreeBSD 10.1 and I'm stumped by this slow scp performance issue when attempting to transfer file *into* FreeBSD. It is summed up as this:
Code:
user@freebsd:~$ scp user@linux:bigfile /dev/null (29MB/s)
user@freebsd:~$ scp bigfile user@linux:/dev/null  (29MB/s)

user@linux:~$ scp user@freebsd:bigfile /dev/null (29MB/s)
user@linux:~$ scp bigfile user@freebsd:/dev/null (6MB/s)
The slowness is only with the last action, scp of a file into FreeBSD. I ruled out that Linux system because I can replicate the same slowness from OS X to FreeBSD too. All machines are connected on a local switch.

It appears to be a possible issue with the sshd() on FreeBSD receiving files on scp. I've tried the following without success:
  • Using arcfour and disabling compression
  • Replacing default sshd with openssh-portable from ports
These are the bare options enabled on my sshd_config:
Code:
$ grep -v "^#" /etc/ssh/sshd_config | grep -ve ^$
Port 22
Protocol 2
LoginGraceTime 1m
PermitRootLogin no
PermitEmptyPasswords no
X11Forwarding no
UseDNS no
Subsystem    sftp    /usr/libexec/sftp-server
Do you have any suggestion on what else I can try to troubleshoot this?

Edit: I tried sftp explicitly from an external system to FreeBSD and was able to transfer at 29MB/s. So this problem is strictly limited using scp only.
 
For debugging SSH use the verbose option option: scp -v
Sometimes it is also helpful looking at ssh -v or ssh -vv
 
Thanks for the pointers. MTU size was the same for both machines. It turns that the FreeBSD machine's AMD CPU was slow with the default AES cipher. Using the lower end (insecure) arcfour cipher solved the issue: scp -c arcfour bigfile user@freebsd:/dev/null
 
Back
Top