Hi,
I use WinSCP .NET assembly via the PowerShell wrapper tool
https://github.com/tomohulk/WinSCP. Works fine, but throughput is extremely low. I would appreciate any tips to overcome the problem.
Details: I activated session logging, the log contains repeatedly these lines:
#
. 2024-11-13 16:58:49.033 Waiting for data timed out, asking user what to do.
. 2024-11-13 16:58:49.033 Asking user:
. 2024-11-13 16:58:49.033 **Host is not communicating for 0 seconds.
. 2024-11-13 16:58:49.033
. 2024-11-13 16:58:49.033 Wait for another 0 seconds?** ()
< 2024-11-13 16:58:49.033 Script: Host is not communicating for more than 0 seconds.
< 2024-11-13 16:58:49.033 Still waiting...
< 2024-11-13 16:58:49.033 Note: If the problem repeats, try turning off 'Optimize connection buffer size'..
I found a tip to turning off
'Optimize connection buffer size' here:
https://winscp.net/eng/docs/message_host_is_not_communicating
I put the code line
$option.AddRawSettings("SendBuf", "0")
into my PowerShell script. However, it seems to have no effect. An upload of a file with size 860 KB took 70 seconds, the session log still contains the block of cited log lines, 32 times. The same upload, using WinSCP GUI, took < 2 seconds. In WinSCP GUI, "optimize connection buffer size" is checked - maybe the problem has another reason? I wondered about the "0 seconds" mentioned in the log. The timeout parameter is set to 60.
Here is the PowerShell code, sensitive data replaced by several "~". Attached as private file are the two log files of the 860 KB file upload. I found no other errors/warnings in the logs.
$option = New-WinSCPSessionOption -HostName "~~~.~~~.~~~.~~~" `
-Protocol Sftp `
-Credential $psCred `
-Timeout 60 `
-PortNumber 22 `
-SshHostKeyFingerprint "~~~~~~~~~~~~"
$option.AddRawSettings("SendBuf", "0")
$session = New-WinSCPSession -SessionOption $option `
-DebugLogLevel 2 -DebugLogPath "D:\ENTW\APP\OMS\TEMP\WINSCP_0002718132.log" `
-SessionLogPath "D:\ENTW\APP\OMS\TEMP\WINSCP_session_0002718132.log"
(Send-WinSCPItem -LocalPath "~~~~~~~~~~" -RemotePath "/inbound" -Remove -WinSCPSession $session).Check() # Exception bei Fehlern
Remove-WinSCPSession -WinSCPSession $session
system configuration:
- Win server 2019
- PowerShell 5.1.17763.6414
- PowerShell wrapper WinSCP-PowerShell-v6.3.4.0
- WinSCP .NET assembly 6.3.4.0
- WinSCP GUI installation version 5.19.6
- protocol sFTP