You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2007/12/11 07:11:34 UTC

Re: FTPClient.storeFile is very slow

In message <14...@talk.nabble.com>, srinivas_nandula writes:
>I am using commons-net FTPClient utility to transfer files, sizes upto 50MB.
>When i try to transfer the file using the command prompt, the file transfers
>in 5 seconds. But when i use the FTPClient Utility, it takes about 1 minute.
>I set the BufferSize etc to about 8MB, but the result is the same. Can
>somebody suggest how i can improve the upload performance?

You probably don't want to use such a large buffer.  Something around the
size of a page of memory or a small multiple thereof should be sufficient
(e.g., 4k or 8k).  If downsizing your buffer doesn't help, try using
storeFileStream and writing your own loop to copy the data from one
stream to another.

Ideally, this sort of task would use sendfile, for which I suppose the
Java equivalent is FileChannel.transferTo, but Commons Net does not
yet make use of java.nio.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org