Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading files in parallel with Java FTP client

I was using GPars to upload files in a parallel manner with ftp4j client library as:

GParsPool.withPool {
            files.eachParallel { file -> ftpClient.upload(directory, stream)
}

But, now I only have server ELB address for which ftp4j client is not working, so I changed the client to Apache Commons Net FTP client, and this is not thread safe because of which I can't do parallelization.

Is there any other FTP library which supports parallelization and remote verification false (to support elb)??

Or, I need to do something on server side (elb configuration) so that I do not need to change ftp client??

like image 365
Yogen Rai Avatar asked May 24 '26 16:05

Yogen Rai


1 Answers

You cannot upload multiple files in parallel over one FTP connection. It does not matter what FTP library are you using and if it is thread safe or not. The protocol itself does not allow that.

And even if it did (like for example SFTP does), it would not bring you any performance advantage.

You have to open a separate connection for each thread.

like image 58
Martin Prikryl Avatar answered May 27 '26 05:05

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!