commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikkel Lauritsen <>
Subject [net] FTPClient receive performance issue
Date Fri, 14 Dec 2012 17:21:41 GMT
Hi all,

I am using FTPClient from Commons Net 3.2 to transfer files from a
Windows server (unknown version) through an ADSL connection to a
MacOS client running Java 1.6.0_37.

If I transfer the same files using the command line FTP client I
get a transfer rate of about 2-3 MB/s, but when using FTPClient
everything slows down to a crawl after what appears to be the first
64KB. I have tested against a Linux based FTP server on my local
network, and there performance seems to be fine.

My code basically does

FTPClient client = new FTPClient();
client.login(username, password));
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024 * 1024);
client.retrieveFile("/foo/bar/baz", baos));

with listener setup, error handling etc. removed for clarity. The
output from a ProtocolCommandListener is

220 Microsoft FTP Service
USER *******
331 Password required for username.
PASS *******
230 User logged in.
200 Type set to I.
227 Entering Passive Mode (1,2,3,4,234,188).
RETR /foo/bar/baz
125 Data connection already open; Transfer starting.

Using a CopyStreamListener I can see that I get 64 chunks of 1kB each
in rapid succession, followed by chunks of 320 and 704 bytes, after
which I get delays of several seconds between chunks.

Judging from the fact that the native FTP client works well I'm hoping
that I can somehow configure my way out of the problems, but so far my
trying to poke around with buffer sizes etc. has made no difference.

Does anybody happen to have any suggestions for how to attack this?

Best regards & thanks,
  Mikkel Lauritsen

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message