title: Multi-threading Indy IdHTTP requests. Performance consideration issues
body: <p>My application queries 7 marketplaces in a row using Indy HTTP client. All marketplaces provide a unified interface to request/response. That said, the structure of request/response is the same for all 7 marketplaces.</p>
  
  <p>I submit <a href="https://en.wikipedia.org/wiki/Global_Trade_Item_Number" rel="nofollow">GTIN</a> to a MainForm's <code>TEdit</code> box and the app posts 7 RESTful requests to the marketplaces and returns XML responses for all of them.</p>
  
  <p>My idea is to wrap each request in a separate thread, but I am really concerned by the performance issues. Normaly I perform 1 request in 3-5 seconds.</p>
  
  <p>Each thread is created in a <code>for</code> statement and initalizes <code>TIdHTTP</code> object, makes a request, gets an XML-response, parses it and ships it back to the MainForm.</p>
  
  <p>When the job is done each thread needs to be terminated (or paused?)
  If the thread completely terminates, then it must perform the same initialization routine on a next request. I find it relatively slow, assuming 7 thread initializations at a time.</p>
  
  <p>However, if the thread is paused it merely resides in memory, has all its factories initialized and is <em>ready</em> to accept next requests. </p>
  
  <p>How do I leave the thread <em>operationally terminated</em>, <strong>but still completely initialized</strong>? I assume, if <code>TIdHTTP</code> and XML-parsing objects stay alive in a paused thead, they will act much faster on the next request. Does it have any sense?</p>