Lessons Learned with Asyncio - Look Ma, I Wrote a Distributed Hash Table
EuroPython Conference via YouTube
Overview
Syllabus
Intro
WHAT DOES ASYNCIO DO..?
WHAT IS A DISTRIBUTED HASH TABLE?
A DISTRIBUTED HASH TABLE (DHT) IS A PEER-TO-PEER KEY / VALUE DATA STORE
THE EVENT LOOP
Programmers define callbacks to be run when the result of a network call is known.
CONFUSED..? DON'T BE, ITS EXACTLY HOW HUMANS THINK ABOUT CONCURRENCY.
asyncio avoids potentially confusing and complicated "threaded" concurrency while retaining the benefits of strictly sequential code.
How do such tasks pause while waiting for non-blocking network based I/O?
COROUTINES (Are FUN!)
BUT WHAT ABOUT CALLBACKS? How do I handle the result of a coroutine?
4 FUTURES AND TASKS (Are also FUN!)
A DHT EXAMPLE HASHING, DISTANCE AND LOOKUPS
GET() & SET() REQUIRE A LOOKUP. All interactions are asynchronous. Lookups are also parallel (concurrent).
WHAT ABOUT NETWORKING?
6 & #7 STREAMS, TRANSPORTS AND PROTOCOLS (Are also a lot of FUNI)
FINAL THOUGHTS... • 100% unit test coverage
Taught by
EuroPython Conference