title: Downloading large files from S3 to Lambda is faster without threads
body: <p>I'm trying to download binary file of size 15GB with python code in Lambda (to EFS because <code>/tmp</code> has a limit of 500 MB), but it takes too much time, so I have timeout error (Lambda's limit is 15 mins).</p>
  <p><strong>In order to easily debug the code I'm working with file of 470MB (<code>abc.tar</code>), and on <code>/tmp</code></strong>.</p>
  <p>I'm trying to make the code to download the file faster using multipart download.</p>
  <p>this is my script without threads:</p>
  <pre><code>import json
  import boto3
  import time
  import os
  from boto3.s3.transfer import TransferConfig
  
  s3 = boto3.client('s3')
  
  def lambda_handler(event, context):
      s_t = time.time()
      config = TransferConfig(use_threads=False)
      s3.download_file('my_bucket', 'abc.tar', '/tmp/abc.tar', Config=config)
      print(&quot;time: &quot;, time.time() - s_t) #print time took to download_file
      return{
          &quot;statusCode&quot;: 200
      }
  </code></pre>
  <p>It took 25 seconds to download <code>abc.tar</code>.</p>
  <p>When I change the config to be <code>use_threads=True</code>, it took 45 seconds (I ran it few times).
  This was pretty surprising to me, because I thoughts threads should make it faster.</p>
  <p>Nevertheless, I tried to use this config (as seeing from <a href="https://medium.com/@ayushi.garg.1710/multipart-upload-and-download-with-aws-s3-using-boto3-with-python-using-nginx-proxy-server-bce35f3d5ba6" rel="nofollow noreferrer">this</a> medium post) with multipart + threads:</p>
  <pre><code>config = TransferConfig(multipart_threshold=1024*20, max_concurrency=3, multipart_chunksize=1024*20, use_threads=True)
  </code></pre>
  <p>And I got timeout (after 70 seconds).</p>
  <p><strong>How can I make the multipart download the file faster?</strong></p>