Does Python asyncio use a thread pool?
It prints out "MainThread" every time. Does this mean that all of the requests are being executed concurrently using the same main thread and it's not using threads from a thread pool to execute each request or are the threads being abstracted?
It's not using worker threads, asyncio
will only use the main thread. Concurrency is achieved through cooperative multitasking by using Python generators (read about coroutines).
This post seems to show that in fact there is a thread pool ...
As well as asyncio
module, the blog post you linked explicitly uses the concurrent.futures
module. The ThreadPoolExecutor
class from that code will spawn worker threads. But the example code in your question will not.