Python Concurrency with asyncio
- 376pagine
- 14 ore di lettura
Learn how to enhance slow Python code with concurrent programming using the asyncio library. This guide covers coroutines and tasks with async/await syntax to execute code concurrently, enabling you to build web APIs, make concurrent web requests with aiohttp, and run thousands of SQL queries simultaneously. It also demonstrates how to create a map-reduce job for processing gigabytes of data concurrently and integrate threading with asyncio to combine blocking code with asynchronous code. Python is known for its flexibility and ease of learning, but it can be slower than lower-level languages. This resource teaches you to improve Python's performance through various concurrency techniques, leveraging the powerful asyncio library to achieve concurrency with a single thread. You'll explore how to run multiple web requests and database queries at once, while also understanding the broader Python concurrency landscape, including multiprocessing and multithreading. The book provides hands-on examples and simplifies complex concurrency concepts with flowcharts, making it easier to visualize task execution. It’s designed for intermediate Python programmers, with no prior concurrency experience required. The author, Matthew Fowler, brings over 15 years of software engineering expertise. Purchase of the print edition includes a free eBook in multiple formats from Manning Publications.
