We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Talks - Joongi Kim: Improving debuggability of complex asyncio applications
Improve debuggability of complex asyncio applications by understanding its limitations, using the right libraries, and leveraging tools like time module, _syncio library, and STEP debugger to inspect and control execution.
- Improving debuggability of asyncio applications starts by understanding the basics of asyncio and its limitations.
- Coroutines and tasks in asyncio are inherently lightweight and should be used to handle I/O-bound tasks, not CPU-intensive tasks.
-
Using libraries like
trio
andcurio
can simplify development and improve performance. - async/await syntax can help write more readable and synchronous-like code, but should be used with caution due to the overhead of switching between the event loop and the CPU.
-
To debug asyncio applications, use tools like the
time
module,_syncio
library, andSTEP
debugger to inspect and control the execution of coroutines and tasks. - When debugging asyncio applications, use a narrowed exception message and inspect the stack trace to identify the problematic code.
-
If using libraries like
async_timeout
oraiosmtpd
, ensure that they are configured correctly and do not interfere with the event loop. -
When using
pytest
in a Jupyter notebook, use thepytest-asyncio
library to properly run and test asyncio tests. -
To improve the performance of asyncio applications, use a profiler like
line_profiler
orsnakeviz
to identify performance bottlenecks and optimize the code. -
To reduce the risk of memory leaks in asyncio applications, use tools like
mypy
andpytest
to identify potential issues before they become a problem.