Contribute Media
A thank you to everyone who has made this possible: Read More

High Performance Networking in Python

Translations: en

Description

Yury Selivanov - High Performance Networking in Python [EuroPython 2016] [19 July 2016] [Bilbao, Euskadi, Spain] (https://ep2016.europython.eu//conference/talks/high-performance-networking-in-python)

The talk will cover new async/await syntax in Python, asyncio library and ecosystem around it, and ways to use them for creating high performance servers. It will explain how to build custom event loops for asyncio, with an example of using the libuv library with Cython to achieve 2-3x performance boost over vanilla asyncio.


The talk will start with an overview of async/await syntax introduced with PEP 492 in Python 3.5. We'll go through asynchronous context managers and iteration protocols it introduces. I'll briefly explain how the feature is implemented in CPython core.

Then we'll explore asyncio design. I'll briefly cover event loop, policies, transports, protocols and streams abstractions. I'll explain that event loops are pluggable, which really makes asyncio a universal framework.

We'll cover libuv - a high performance networking library that drives NodeJS. I'll highlight where it's similar to asyncio and how it's different.

In the final part of the talk I'll explain how to make an asyncio compatible event loop on top of libuv. I'll showcase Cython, which is an amazing tool for tasks like this.

Finally, I'll share some ideas on how we can further improve the performance of asyncio and networking in Python, and what are the challenges that we will face.

Objectives:

  1. Deeper understanding of async/await in Python and why it's important.
  2. Deeper understanding of asyncio architecture and protocols.
  3. How to improve asyncio performance by implementing custom event loops.
  4. Show that it's easy to integrate existing complex & low level libraries with Cython.
  5. Some perspective on how Python may evolve wrt networking.
Improve this page