# How can asyncio be used to speed up integration tasks?
---
# What is asyncio?
- Python library to write concurrent code using the async/await syntax
- It lets you run and manage Python coroutines, create and manage event loops, etc...
- Often a perfect fit for IO-bound code
- Alternative to multiprocessing, threading
https://docs.python.org/3/library/asyncio.html
---
# Concurrent vs. Parallel
- asyncio operates only one CPU core inside one thread

---
# IO-bound vs CPU-bound
- io-bound code

- cpi-bound code
- 
---
# Hello World! Example
```
import asyncio
async def main():
print('Hello ...')
await asyncio.sleep(1) # Other code can be run while waiting.
print('... World!')
asyncio.run(main())
```
# Async Solution Diagram

{"metaMigratedAt":"2023-06-17T18:29:14.064Z","metaMigratedFrom":"Content","title":"How can asyncio be used to speed up integration tasks?","breaks":true,"contributors":"[{\"id\":\"2922d786-b8c0-4dd9-8f1e-317640897836\",\"add\":969,\"del\":60}]"}