12

I'm using FileZilla 3.10.3 and PSFTP 0.63 (PuTTY). Can anyone help me figure out why the throughput I get is so drastically different between the two clients? It can't just be a shortcoming of the SFTP protocol, because FileZilla (and WinSCP) is so much faster! Thanks in advance.

When using FileZilla to connect to the same server using some protocol, I get "good" throughput; ~1.2MBPS for one big file. Here's the log:

Response: fzSftp started, protocol_version=2
Command: open "mecorp@ftp.themcorp.com" 22
Trace: Looking up host "ftp.themcorp.com"
Trace: Connecting to 222.22.111.33 port 22
Trace: We claim version: SSH-2.0-PuTTY_Local:_Mar_29_2015_12:25:15
Trace: Server version: SSH-2.0-9.99 sshlib: 8.1.0.0
Trace: Using SSH protocol version 2
Trace: Doing Diffie-Hellman group exchange
Trace: Doing Diffie-Hellman key exchange with hash SHA-1
Trace: Host key fingerprint is:
Trace: ssh-dss 1024 20:88:a6:92:fe:11:db:b4:9a:b5:9e:8b:5f:50:bb:77
Trace: Initialised AES-256 SDCTR client->server encryption
Trace: Initialised HMAC-SHA1 client->server MAC algorithm
Trace: Initialised AES-256 SDCTR server->client encryption
Trace: Initialised HMAC-SHA1 server->client MAC algorithm
Command: Pass: ********
Trace: Sent password
Trace: Access granted
Trace: Opening session as main channel
Trace: Opened main channel
Trace: Started a shell/command
Status: Connected to ftp.themcorp.com
Trace: CControlSocket::ResetOperation(0)
Status: Starting upload of c:\temp\test.zip
Command: cd "/Home/mecorp"
Response: New directory is: "/Home/mecorp"
Trace: CControlSocket::ResetOperation(0)
Trace: FileTransferSend()
Command: put "c:\temp\test.zip" "test.zip"
Status: local:c:\temp\test.zip => remote:/Home/mecorp/test.zip
Trace: FileTransferParseResponse()
Trace: CControlSocket::ResetOperation(0)
Status: File transfer successful, transferred 27,974,088 bytes in 21 seconds

When using PSFTP to connect to the same server using the same protocol and transferring the same file, I get much slower throughput. I'd estimate about 150kbps (looking at I/O bytes in Windows 7 task manager). Here's the log:

C:\temp>c:\d2\trunk\Util\psftp.exe -v -l mecorp -pw topsecret -P 22 ftp.themcorp.com
Looking up host "ftp.themcorp.com"
Connecting to 222.22.111.33 port 22
Server version: SSH-2.0-9.99 sshlib: 8.1.0.0
Using SSH protocol version 2
We claim version: SSH-2.0-PuTTY_Release_0.63
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
Host key fingerprint is:
ssh-dss 1024 20:88:a6:92:fe:11:db:b4:9a:b5:9e:8b:5f:50:bb:77
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Using username "mecorp".
Sent password
Access granted
Opening session as main channel
Opened main channel
Started a shell/command
Connected to ftp.themcorp.com
Remote working directory is /Home/mecorp
psftp> put test.zip test.zip
local:test.zip => remote:/Home/mecorp/test.zip
psftp>
Martin Prikryl
  • 7,327
  • 2
  • 36
  • 71
Chris
  • 231
  • 1
  • 6

1 Answers1

24

The FileZilla uses a PuTTY/psftp source code for an SFTP implementation. Actually the FileZilla runs a hidden PSFTP sub-process.

But it uses its own build of PSFTP (FzSFtp.exe) that employs few optimizations (and other modifications), including:

  • SFTP transfer queue is 4 MB (comparing to 1 MB in PSFTP)
  • Allocates memory in much larger chunks (32 KB comparing to 515 B)
  • Uses large network buffers (4 MB for SO_RCVBUF and dynamic size for SO_SNDBUF [using SIO_IDEAL_SEND_BACKLOG_QUERY]). PSFTP keeps the system defaults.

FileZilla also uses a different compiler (mingw) than PuTTY (VS), what may contribute.


WinSCP is also based on PSFTP code (though it uses PSFTP code internally, not in an external sub-process) and uses a similar set of optimizations.

Martin Prikryl
  • 7,327
  • 2
  • 36
  • 71