Dawnpool opened a new pull request, #47533:
URL: https://github.com/apache/airflow/pull/47533

   This PR implements concurrent directory transfer functions for the SFTP 
Operator.
   
   The SFTP hook now includes two new functions, 
`retrieve_directory_concurrently` and `store_directory_concurrently`, which are 
concurrent versions of the existing ones. They utilize multi-threading via 
Python’s `concurrent.futures`, resulting in a significant speed improvement. 
Also, each thread opens a new connection and transfers a chunk of files 
assigned to it since the paramiko library is not thread-safe.
   
   The SFTP operator now has a new parameter, `concurrency`, and uses the 
concurrent version of the hook file when this value is greater than 1. It 
continues to use the existing sequential version when the value is 1.
   
   I tested it by transferring a directory containing 1,000 small files. The 
results showed a dramatic performance improvement: **storing the directory 
decreased from approximately 24 seconds to 2 seconds, and retrieving it 
decreased from about 42 seconds to 4 seconds.**


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to