title: Apache Camel - SFTP latency
body: <p>I'm using Apache Camel to interact with several SFTP endpoints; for each one, I perform the following pipeline:</p>
  <ul>
  <li>retrieve the list of existing files</li>
  <li>validate those files against a given set of rules</li>
  <li>download remote files, in case of successful validation</li>
  </ul>
  <p>Everything works like a charm (for about a hundred different endpoints) and the URI used to retrieve the list of files is something like that: sftp://${HOST}:${PORT}/${DIR}?username=${USER}&amp;download=false&amp;recursive=true&amp;disconnect=true&amp;sendEmptyMessageWhenIdle=true</p>
  <p>The problem is that, for one of those SFTP endpoints, the SFTP Camel component behaves, alternatively, as follows:</p>
  <ul>
  <li>immediately return 0 remote files</li>
  <li>takes a couple of minutes to list the remote content (which is composed by around 250 files, from 2KB to 2MB each)</li>
  </ul>
  <p>In addition, in the latter case, the download takes around 30 seconds to download only 10KB of data.</p>
  <p>Since this is happening on this specific SFTP only, I suppose it doesn't directly depend on Camel, which works fine for all other endpoints.</p>
  <p>So, my questions are:</p>
  <ul>
  <li>what can affect such a connection, leading to an unreasonable delay (there are no network issues, nor huge data to fetch)?</li>
  <li>supposing it depends on the remote SFTP endpoint, why should the aforementioned Camel URI immediately return 0 files, since lots of files exist in the SFTP?</li>
  </ul>
  <p>Thanks for any feedback.</p>