Django on Gevent

A Talk presented by Cody Soyland
log in to bookmark.

Audience level

Intermediate

Category

How To/Intro

Time

September 4th, 2:20 p.m. – 3 p.m.


Description

This is an introduction to using the Gevent networking library to empower your Django application with realtime features and resource-efficient cooperative concurrency. Django's synchronous APIs make it impractical to use in a callback-based networking library, but fast single-threaded concurrency is still possible using the mind-blowing capabilities of coroutines.


Abstract

Gevent is an ultra-fast networking library built on top of the greenlet module. Greenlets are the ideal solution to making Django's synchronous API calls possible in a cooperative concurrency environment.

I'll begin with an overview of the models of network programming, including threading, callbacks, and coroutines. I'll explain how greenlets (coroutines) work in harmony to provide simple blocking network APIs while not blocking execution of the entire thread. I'll show how easy it is to integrate other network services into your app.

As an exploration into using realtime features in Django, I'll demonstrate a simple realtime collaboration app that uses websockets for communication. I will show how to integrate ZeroMQ to allow the app to scale beyond a single server. I will also show how to attach to and monitor your web app using gevent.backdoor.