Jimmy Lai is a Software Engineer in Instagram Infrastructure. His recent interest is Python efficiency, including profiling, optimization and asyncio. He has been sharing his experiences in PyCon Taiwan since 2012. This year, he plan to share his automated refactoring experience on large scale Python codebase.
Adopting Python Asyncio in Large Scale Project (Instagram)
- Location: R0
- Slot: Day 1, 16:05‑16:50
- Category: Best Practices & Patterns
- Language: English talk
- Python Level: Intermediate
Abstract
Asyncio is one of the new killer features in Python3. It enables concurrent IOs in single thread. Adopting Asyncio in an existing large project is hard because: 1. many changes needs to be made and automation is the key. 2. identify required changes is not straight forward and static analysis with profiling tools is required 3. issues like nested loop and orphan future close loop bug make adoption risky; so bug fixes and optimizations are needed. In this talk, we share our strategy to adopt asyncio and the tools we built: including common helper library for asyncio testing/debugging/profiling, static analysis and profiling tools for identify call stack, bug fixes and optimizations for asyncio module, design patterns for asyncio, etc. Those experiences are learn from large scale project -- Instagram Django Service serves more than 500 million daily active users.