Payal created NET-690:
-------------------------

             Summary: Performance issue when using the FTPClient to retrieve 
files from z/OS and z/VM
                 Key: NET-690
                 URL: https://issues.apache.org/jira/browse/NET-690
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 3.7,1
         Environment: {code:java}
Java 8, FTP server on z/OS | z/VM{code}
            Reporter: Payal
             Fix For: 3.7.2


Performance issue when using the FTPClient to retrieve files from z/OS and 
z/VMPerformance issue when using the FTPClient to retrieve files from z/OS and 
z/VM
There is a significant performance drop off when using the FTPClient to 
retrieve files from z/OS and z/VM ( I haven't tested against other operating 
systems). If I switch to using the FTPSClient I don't see the same problem.


The following is the command output when doing a retrieve of a file from z/OS 
which is only 2.0KB in size:

*FTPClient:*

2020-10-07 08:30:46.261 SENT>>> RETR

2020-10-07 08:30:46.291 RECD<<< 125 Sending data set TEST.FTP(PART11B) FIXrecfm 
80

2020-10-07 08:32:46.342 RECD<<< 250 Transfer completed successfully.

*FTPSClient:*

2020-10-07 08:30:45.813 SENT>>> RETR

2020-10-07 08:30:45.843 RECD<<< 125 Sending data set TEST.FTP(PART11B) FIXrecfm 
80

2020-10-07 08:30:46.014 RECD<<< 250 Transfer completed successfully.


The first transfer using the FTPClient took 2 minutes, which when switching to 
using FTPS take less than a second. This has only been an issue since upgrading 
from commons-net 3.6 to 3.7.1. It seems to consistently take 2 minutes transfer 
pretty much regardless of the size of the file, so appears to be waiting on 
something or hitting a timeout of some sort. 

I have added the code I'm using to establish the FTPClient and connect to the 
host and to retrieve the file. 

 
{code:java}
//Establish the FTPClient and connect to the host

        private FTPClient getFTPClient(String host, String userProperty, String 
passwordProperty) throws SocketException, IOException {
                FTPClient client = new FTPClient();
                client.addProtocolCommandListener(this);
                client.connect(host);
                client.login(getProperties().getProperty(userProperty), 
getProperties().getProperty(passwordProperty));
                client.enterLocalPassiveMode();
                return client;
        }

//Retrieve file

        private void getFile(String remoteDir,String localDir, String file, 
FTPClient client) throws IOException, FileNotFoundException {
                client.changeWorkingDirectory(remoteDir);
                client.setFileType(FTP.BINARY_FILE_TYPE);
                BufferedOutputStream bo = new BufferedOutputStream(new          
             FileOutputStream(localDir + file));
                client.retrieveFile(file, bo);
                bo.close();
        }
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to