title: improving speed of "Sending 100,000 request" by asyncio using multi-process and multi-thread
body: <p>First of all, I want to send multiple-request using 1 connection as fast as possible. The code below work fine and fast but I want it to go beyond asynchronous. Back to my question, is it possible to run this in parallel using multi-threading or multi-processing. I heard that you could use ThreadPoolExecutor or ProcessPoolExecutor.</p>
  
  <pre><code>import random
  import asyncio
  from aiohttp import ClientSession
  import time
  from concurrent.futures import ProcessPoolExecutor
  
  async def fetch(sem,url, session):
      async with sem:
          async with session.get(url) as response:
              return await response.read()
  async def run(r):
      url = "http://www.example.com/"
      tasks = []
      sem = asyncio.Semaphore(1000)
      async with ClientSession() as session:
          for i in range(r):
              task = asyncio.ensure_future(fetch(sem, url.format(i), session)) #return a task
              tasks.append(task)
          responses = asyncio.gather(*tasks)
          await responses
  if __name__ == "__main__":
      number = 10000
      loop = asyncio.get_event_loop()
      start = time.time()
      loop.run_until_complete(run(number))
      end = time.time() - start
      print (end)
  </code></pre>
  
  <p>from testing, it managed to sent roughly 10k request in 49sec.
  I need it to be faster, any suggestion? (thread, process)</p>