Search⌘ K
AI Features

Asynchronous with Executors

Explore how to use executors with asynchronous code in Python to handle long-running tasks by offloading work to thread and process pools. Understand the impact of the Global Interpreter Lock on concurrency and learn strategies to maintain responsive and scalable services.

We'll cover the following...

Asynchronous with Executors

In the previous section, we wrote an asynchronous version of our service that used the same event loop to juggle between incoming requests and performing calculations. A long-running request made the service completely unavailable. One mitigation we can apply is to offload the calculation work to thread or process pools, same as what we did in our multithreaded approach. The changes ...