为什么FileZilla比PSFTP快得多?

我正在使用FileZilla 3.10.3和PSFTP 0.63(PuTTY)。 任何人都可以帮我弄清楚为什么我得到的吞吐量在两个客户端之间是如此巨大的不同? 它不仅仅是SFTP协议的一个缺点,因为FileZilla(和WinSCP)速度更快! 提前致谢。

当使用FileZilla连接到使用某种协议的同一台服务器时,我获得了“良好”的吞吐量; 一个大文件〜〜1.2MBPS。 这里是日志:

Response: fzSftp started, protocol_version=2 Command: open "[email protected]" 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 

当使用PSFTP使用相同的协议连接到相同的服务器并传输相同的文件时,吞吐量会变慢。 我估计约150kbps(看Windows 7任务pipe理器中的I / O字节)。 这里是日志:

 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> 

    FileZilla使用PuTTY / psftp源代码来实现SFTP。 其实FileZilla运行一个隐藏的PSFTPsubprocess。

    但是它使用自己构build的FzSFtp.exeFzSFtp.exe ),它使用less量优化(和其他修改),包括:

    • SFTP传输队列为4 MB(与PSFTP中的1 MB相比)
    • 以更大的块分配内存(32KB比515B)
    • 使用大型networking缓冲区(SO_RCVBUF为4 MB,SO_SNDBUF为[使用SIO_IDEAL_SEND_BACKLOG_QUERY])。 PSFTP保持系统默认值。

    FileZilla也使用一个不同的编译器(mingw)而不是PuTTY(VS),可能会有所贡献。


    WinSCP也基于PSFTP代码(尽pipe它在内部使用PSFTP代码,而不是在外部subprocess中)并使用类似的一组优化。