Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.2k views
in Java FTP by (420 points)
I am experiencing significant performance differences between the file upload transfer rates of the FTPClient vs ProFTPClient classes. Typically, the ProFTPClient is nearly half the speed.

I use the FTPProgressMonitor interface to define a class that implements the bytesTransferred() method, and it is in here that I calculate throughput.

Same file uploaded via the same proxy to the same FTP server reveals this difference.

I even disabled the TransferIntegrityCheck to see if this made any difference - no joy.

Any advice on other options to try?


Cheers,

Dan

8 Answers

0 votes
by (420 points)
Further Info:

Digging into things a bit further...it seems that it is the SOCKS5 proxy setting that is the differentiating factor.

I set the proxy port to 1080 and the proxy type to SOCKS5 when I'm using the ProFTPClient class.

The FTPClient class doesn't have the same support for proxies, so I set the hostname to the proxy server, then login with username "user@remote.ftp.server"....and magically the proxy server figures out what to do.

So, the FTPClient class believes it is talking directly to the remote FTP server, whereas the ProFTPClient class is explicitly using a SOCKS5 proxy. The difference in performance is startling.

How can I use the FTP proxy directly with ProFTPClient?
0 votes
by (420 points)
By the way - the reason I do not want to continue to use the 'hack' of connecting directly to the proxy and using "user@remote.ftp.server" as the login username, is that sometimes the "user" part is actually an email address....resulting in "blah@email.host@remote.ftp.server" being sent to login.

That crazy format gives my proxy digital thrombosis ;)

No...I have absolutely no control over the proxy :(
0 votes
by (162k points)
It might be helpful to post debug logs for each case.
0 votes
by (420 points)
Using FTPClient (via 'hack' username of user@remote.ftp.server)
>>>
debug:
DEBUG [FTPClient] 8 Jun 2013 12:51:15.244 : Class: com.enterprisedt.net.ftp.FTPClient
Location: file:TestHarness/lib/edtftpj-pro.jar
Version: 4.4.0
Build timestamp: 5-Dec-2012 15:58:52 EST
Java version: 1.5.0_15
CLASSPATH: TestHarness/lib/edtftpj-pro.jar:netbeans/platform/modules/ext/junit-4.10.jar:TestHarness/build/classes
OS name: Linux
OS arch: amd64
OS version: 2.6.32.59-0.3.1.4320.0.PTF-default

DEBUG [FTPClient] 8 Jun 2013 12:51:15.260 : Connecting to ftpproxy.blah.com/1.2.3.4:21
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:15.280 : 220 [002-0018] host.blah.com FTP proxy 5.1.11 ready.
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:15.281 : ---> USER testuser@remote.ftp.server
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:15.802 : 331-( [002-0059] Firewall connected to remote.ftp.server (5.6.7.8).)
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:15.841 : 331-(220 ProFTPD 1.3.4a Server (Debian) [::ffff:a.b.c.d])
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:15.841 : 331 Password required for testuser
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:15.841 : ---> PASS ********
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.045 : 230 User testuser logged in
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.045 : ---> TYPE I
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.099 : 200 Type set to I
Transferring file...
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.105 : ---> PWD
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.158 : 257 "/home/testuser" is the current directory
DEBUG [FTPClient] 8 Jun 2013 12:51:16.158 : Attempt #1
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.158 : ---> PASV
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.271 : 227 Entering Passive Mode
INFO [FTPControlSocket] 8 Jun 2013 12:51:16.271 : Substituting server supplied IP (5.6.7.8) with remote host IP (5.6.7.8)
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.273 : ---> STOR testupload
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:16.330 : 150 Opening BINARY mode data connection for testupload
DEBUG [FTPClient] 8 Jun 2013 12:51:19.463 : Transferred 2120972 bytes to remote host
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:20.030 : 226 Transfer complete
...complete
Transfer rate : 690 Kb/s
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:20.030 : ---> DELE testupload
DEBUG [FTPControlSocket] 8 Jun 2013 12:51:20.087 : 250 DELE command successful
BUILD SUCCESSFUL (total time: 5 seconds)
>>>

Using ProFTPClient (via SOCKS5 proxy)
>>>
debug:
DEBUG [FTPClient] 8 Jun 2013 12:53:12.301 : Class: com.enterprisedt.net.ftp.pro.ProFTPClient
Location: file:TestHarness/lib/edtftpj-pro.jar
Version: 4.4.0
Build timestamp: 5-Dec-2012 15:58:52 EST
Java version: 1.5.0_15
CLASSPATH: TestHarness/lib/edtftpj-pro.jar:netbeans/platform/modules/ext/junit-4.10.jar:TestHarness/build/classes
OS name: Linux
OS arch: amd64
OS version: 2.6.32.59-0.3.1.4320.0.PTF-default

DEBUG [ProFTPClient] 8 Jun 2013 12:53:12.309 : Connecting to remote.ftp.server:21
DEBUG [StreamSocketFactory] 8 Jun 2013 12:53:19.345 : Connecting to remote.ftp.server:21 via SOCKS5 proxy
DEBUG [Socks5ProxySocket] 8 Jun 2013 12:53:19.353 : sending request without username/pwd
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:19.887 : 220 ProFTPD 1.3.4a Server (Debian) [::ffff:a.b.c.d]
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:19.889 : ---> USER testuser
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:19.943 : 331 Password required for testuser
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:19.943 : ---> PASS ********
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.132 : 230 User testuser logged in
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.133 : ---> TYPE I
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.187 : 200 Type set to I
Transferring file...
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.191 : ---> PWD
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.244 : 257 "/home/testuser" is the current directory
DEBUG [FTPClient] 8 Jun 2013 12:53:20.245 : Attempt #1
DEBUG [ProFTPControlSocket] 8 Jun 2013 12:53:20.245 : Checking if IPV6:java.net.Inet4Address (1.2.3.4)
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.245 : ---> PASV
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.298 : 227 Entering Passive Mode
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:20.299 : Using proxy
INFO [FTPControlSocket] 8 Jun 2013 12:53:20.299 : Substituting server supplied IP (5.6.7.8) with remote host IP (remote.ftp.server)
DEBUG [StreamSocketFactory] 8 Jun 2013 12:53:22.840 : Connecting to remote.ftp.server:59857 via SOCKS5 proxy
DEBUG [Socks5ProxySocket] 8 Jun 2013 12:53:22.840 : sending request without username/pwd
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:22.942 : ---> STOR testupload
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:23.001 : 150 Opening BINARY mode data connection for testupload
DEBUG [FTPClient] 8 Jun 2013 12:53:37.936 : Transferred 2120972 bytes to remote host
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:39.126 : 226 Transfer complete
...complete
Transfer rate : 121 Kb/s
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:39.126 : ---> DELE testupload
DEBUG [FTPControlSocket] 8 Jun 2013 12:53:39.182 : 250 DELE command successful
BUILD SUCCESSFUL (total time: 27 seconds)
0 votes
by (420 points)
FTPClient transferred the file in 3 seconds, ProFTPClient transferred it in 14 seconds.
0 votes
by (420 points)
I have a tentative, provisional and highly shonky patch that enables the ProFTPClient to operate in raw FTP proxy mode. So far, it successfully transfers files at normal (high) speeds.

Would welcome some eyeballs to inspect it. It's not very complicated.

Where could I send a patch?
0 votes
by (162k points)
Sure, send it to support at enterprisedt dot com
0 votes
by (420 points)
Patch sent via email

Categories

...