Skip to content Skip to sidebar Skip to footer

Is It Necessary To Open A Sftpclient Per One Thread In Paramiko With Multi-threading?

I want to download files from remote server using Paramiko with multithreading. There are two solution came into my mind, but I'm not sure which is right (or better). Solution 1: A

Solution 1:

Paramiko is not thread safe.

Using multiple threads over one connection might not give you the performance you hope for anyway. You would have to open a separate connection (SSHClient/SFTPClient) per thread.

With one connection, you would have better performance, only with scenarios like a transfer of large amount of small files. For that, see Slow upload of many small files with SFTP.

Post a Comment for "Is It Necessary To Open A Sftpclient Per One Thread In Paramiko With Multi-threading?"