[JSch-users] Enormous traffic when uploading file to non-empty folder
Status: Alpha
Brought to you by:
ymnk
From: Milano N. <dra...@gm...> - 2016-08-25 05:53:00
|
OK, now I feel embarassed and stupid for not noticing earlier that in my code there is hidden the *ChannelSftp.ls* call. No idea why. It's been there since beginning of the app. It is called once when new file abstraction is requested and once for any other operation (e.g. requesting an OutputStream from the abstraction). *Let's do the math now:* If you have about 6400 files in the upload directory, it means about 1,5 MB of data to download if you want to list it. And it can take up to two minutes (120 seconds) to download such data depending on your connection. So if you want to *upload* one *4KB* file to the SFTP using streams, you are going to *download 3MB* of useless data first, *wait* up to about *four minutes* and then your file is downloaded. I'm not even speaking about the fact the operation is going to fail if your connection is slow since you're not going to simply download so much data on a bad connection. Thanks to Lothar for pointing me to the right direction! |