title: Fastest parallel requests in Python
body: <p>I need to keep making many requests to about 150 APIs, on different servers.
  I work with the trading, time is crucial, I can not waste 1 millisecond.</p>
  
  <p>The solution and problems I found were these:</p>
  
  <ul>
  <li>Async using Asyncio: I do not want to rely on a single thread, for some reason it may get stucked.</li>
  <li>Threads: Is it really reliable on Python to use threads? Do I have the risk of 1 thread make<br>
  other get stucked?</li>
  <li>Multiprocesses: If a have on process controlling the others, would I
  loose to much time in interprocess communication?</li>
  </ul>
  
  <p>Maybe a solution that uses all of that.</p>
  
  <p>If there is no really good solution in Python, what should I use instead?</p>
  
  <pre><code># Using Asyncio
  import asyncio
  import requests
  
  async def main():
      loop = asyncio.get_event_loop()
      future1 = loop.run_in_executor(None, requests.get, 'http://www.google.com')
      future2 = loop.run_in_executor(None, requests.get, 'http://www.google.co.uk')
      response1 = await future1
      response2 = await future2
      print(response1.text)
      print(response2.text)
  
  loop = asyncio.get_event_loop()
  loop.run_until_complete(main())
  
  
  # Using Threads
  from threading import Thread
  
  def do_api(url):
      #...
      #...
  
  #...
  #...
  for i in range(50):
      t = Thread(target=do_apis, args=(url_api[i],))
      t.start()
  </code></pre>