title: Downloading archives from a virtual machine takes too much time to start
body: <p>I wrote a program in Python which downloads a .tar.gz archive from a virtual machine. The download works fine, but the problem is that it takes too much time to start. Here's the part of my code that handles the downloading:</p>
  <pre><code>import os
  from wsgiref.util import request_uri
  from wsgiref.simple_server import make_server
  
  def download(self,dirr):
       file_url = os.environ['location'] + dirr
       headers = [('Content-Description', 'File Transfer'),
                 ('Content-Type', 'application/octet-stream'),
                 ('Content-Disposition', 'attachement; filename=&quot;'+os.path.basename(file_url)+'&quot;'),
                 ('Expires', '0'),
                 ('Cache-Control', 'must-revalidate'),
                 ('Pragma', 'public'),
                 ('Content-Length', str(os.stat(file_url).st_size))]
          
        file_download = open(file_url, 'rb')
        return headers, file_download.read()
  
  def server_app(environ, start_response):
      crt_handler = handler(request_uri(environ))
      headers, response_body = crt_handler.get() // this calls my download function, which is part of a class. 
      status = '200 OK'
      start_response(status, headers)
      return [response_body] 
  
  def start_server():
     httpd = make_server(&quot;&quot;, PORT, server_app)
     httpd.serve_forever()
  </code></pre>
  <p>Sorry if some things don't make sense in my code, I've pasted only the part that does the downloading. The program does much more. Anyway, is it possible to make the downloads start faster?</p>