Page 1 of 1

SFTP very slow in batchmode, very fast interactive mode

Posted: 2020/03/05 08:17:16
by steven.foo@idt.com
Hi,

We have an issue one several centos servers where we tried to SFTP to another external server outside our company.

Interactive mode - human enter command.
- in this way, the transfer for 100MB file is very fast. We have no issue. Take 20-30 secs to complete.

sftp -vvv username@[sftp server name or IP]

Batch mode - script/passing of multiple commands.
- in this way, the transfer for 100MB file is very slow. Take hours to complete.

sftp -vvv -oBatchMode=no -b [script name] username@[sftp server name or IP]
or
sftp -vvv username@[sftp server name or IP] <<< $'cd /upload\n put mysqld.org'

Command enter manually and the one in the script file is the same.

Both are using the same file, ISP and line to the external site.

We have spend 3 days trying to test and figure out why. Still we have no idea why this is happen.
The firewall, there is no limit for port 22 to the external site.

Any idea why this is happening?

Re: SFTP very slow in batchmode, very fast interactive mode

Posted: 2020/03/05 19:41:14
by aks
No.
The obvious difference is BatchMode. Does it make a difference if -b is - (stdin) and you copy and paste the batch? Could be buffer over/unser runs for example, well I guess a terminal is not "attached" in BatchMode.
Beyond that, take a deep breath and strace what's happening (and then send a day looking at the trace...)