-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file uploads are very slow compared to java jsch library #472
Comments
Hi, please try enabling ConcurrentWrites |
I tried upload with "ConcurrentWrites" now upload time is almost same as java jsch. I have few questions
|
it could be related to the concurrency, for example take a look here, try to understand in your use case which concurrency value is used, you can change this value sending buffers of different sizes
Concurrent writes are not safe if you want to implement resumable uploads, if you application crashes and so you cannot truncate the file to the uploaded size a successive resume will produce an inconsistent file
Concurrent writes help on high latency networks (on local networks there is no difference). I haven't looked at java jsch code but they should use some form of concurrency to achieve that performance |
@drakkan Thanks for your quick response it helped me a lot. |
Your jsch is almost certainly not doing only sequential uploads, it is doing concurrent uploads. (This is evident by the speed of the upload.) To get the speeds you’re seeing, it must be transferring data in parallel ahead of the actual request. There are some new considerations of how to process sftp requests that could make ConcurrentWrites more safe, but this would be for a future implementation of the client. We took a highly safe approach here on concurrency that ensured safety over potential issues. |
Thanks @puellanivis, if concurrentWrites does not corrupt file when uploads are interrupted it will be helpful. |
Unfortunately, we’re not able to ensure that concurrentWrites would not corrupt the file in an error situation. I think a few changes are being made (sequential request ordering) that would make it safer, but I’d have to look at things afresh. |
This was fixed in #482, please reopen if it still does not work as expected |
Upload of 50mb file using sftp module took 237s while java jsch takes only 24s. My observation is most of the time is going in writing data to remote file though stream. I tried different ways of writing to stream (which i kept in comments in main.go) but none improved performance.
Attaching Java and Go Samples with source code (src.zip) and binaries(bin.zip). Instructions on how to execute these binaries is documented in README.txt in bin.zip.
bin.zip
src.zip
The text was updated successfully, but these errors were encountered: