title: Delphi Berlin: TIdHTTPServer (Indy 10) benefit of KeepAlive
body: <p>I have a server that handle both <code>http</code> and <code>https</code> request.</p>
  
  <p>The common routine between client and server is based on two request:</p>
  
  <p>1) The user request a file with an url, eg.: </p>
  
  <p><a href="https://example.com/get?id=10" rel="nofollow noreferrer">https://example.com/get?id=10</a></p>
  
  <p>2) The server makes some check and redirect in the response headers to a new url:</p>
  
  <pre><code>location: https://example.com/files/10.zip
  </code></pre>
  
  <p>3) The browser, after redirect to the new url, request the file: </p>
  
  <p><a href="https://example.com/files/10.zip" rel="nofollow noreferrer">https://example.com/files/10.zip</a></p>
  
  <p>4) The server, sends the file "10.zip" in the response stream:</p>
  
  <pre><code>ResponseInfo.ContentStream := TFileStream.Create('C:\10.zip', fmOpenRead or fmShareDenyNone);
  </code></pre>
  
  <p>all routine is of two request (1, 4), and for this reason i have disabled session and keepAlive:</p>
  
  <pre><code>IdHTTPServer.KeepAlive        := False;
  IdHTTPServer.AutoStartSession := False;
  IdHTTPServer.SessionState     := False;
  </code></pre>
  
  <p>I think keep alive has huge benefit only on multiple round trip, this seem a good idea into my scenario when user use http, but, maybe this isn't a good idea when the user use https, because each request without KeepAlive is a new request and the initial setup costs of a HTTPS connection are far higher.</p>
  
  <p>Enabling KeepAlive on <code>IdHTTPServer</code> has some performance benefit into my scenario?</p>
  
  <p>Apache 2.4 has default KeepAliveTimeout at 5 seconds. For IndyServer is good a value in order of some seconds?</p>