Why Async Programming?
In traditional synchronous code, operations block execution until they complete. This is a problem when dealing with I/O-bound tasks:
Learning Objectives
Lesson Outline
In traditional synchronous code, operations block execution until they complete. This is a problem when dealing with I/O-bound tasks:
| Operation | CPU Work | Waiting Time |
|---|---|---|
| HTTP Request | ~1ms | ~200ms |
| Database Query | ~1ms | ~50ms |
| File Read | ~1ms | ~10ms |
Most of the time is spent waiting, not computing. Async programming lets us do useful work during that wait time.
Result: 3x faster by running requests concurrently!