Christian Nedregård created CAMEL-14947:
-------------------------------------------

             Summary: camel-sftp: check for existance of remote directory using 
ls is very slow
                 Key: CAMEL-14947
                 URL: https://issues.apache.org/jira/browse/CAMEL-14947
             Project: Camel
          Issue Type: Bug
          Components: camel-ftp
    Affects Versions: 2.25.1
            Reporter: Christian Nedregård


In CAMEL-12733 the check for existing directories used by autoCreate was 
changed from {{ChannelSftp.cd}} to {{ChannelSftp.ls}} to fix a Windows specific 
issue.

{{cd}} is a remote operation while {{ls}} will actually load the full directory 
listing and load it over the wire. This happens for every file that are to be 
written. If the remote directory has a lot of files this has a heavy 
performance penalty.

In our case the directory some times contains 50.000+ files. Without autoCreate 
the writes take a few milliseconds. With autoCreate it takes up to 10 seconds 
due to the huge directory listing being generated and loaded over the wire for 
every single file to be written.

This can be solved by reverting the directory check to a remote operation such 
as {{cd}} and fixing the Windows specific issue in another way.

If it turns out that {{ls}} has to be used (unlikely) please note that there is 
another variant that takes a selector that enables you to abort the actual 
loading of the listing:
{code:java}
ls(String path, LsEntrySelector selector){code}
 



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

Reply via email to