Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Concurrency to Channels
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Andrew Godwin
October 08, 2017
Programming
1
350
Concurrency to Channels
My keynote from Python Brasil 13 (2017).
Andrew Godwin
October 08, 2017
Tweet
Share
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
370
Django Through The Years
andrewgodwin
0
290
Writing Maintainable Software At Scale
andrewgodwin
0
500
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
400
Async, Python, and the Future
andrewgodwin
2
720
How To Break Django: With Async
andrewgodwin
1
780
Taking Django's ORM Async
andrewgodwin
0
770
The Long Road To Asynchrony
andrewgodwin
0
750
The Scientist & The Engineer
andrewgodwin
1
820
Other Decks in Programming
See All in Programming
Unity6.3 AudioUpdate
cova8bitdots
0
140
Understanding Apache Lucene - More than just full-text search
spinscale
0
120
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
270
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
190
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
600
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
560
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
モダンOBSプラグイン開発
umireon
0
140
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
550
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.9k
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.4k
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
240
Featured
See All Featured
Visualization
eitanlees
150
17k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
130
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Producing Creativity
orderedlist
PRO
348
40k
Why Our Code Smells
bkeepers
PRO
340
58k
Writing Fast Ruby
sferik
630
63k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
Large-scale JavaScript Application Architecture
addyosmani
515
110k
WENDY [Excerpt]
tessaabrams
9
36k
Transcript
Andrew Godwin @andrewgodwin
Hi, I’m Andrew Godwin • Django core developer • Senior
Software Engineer at • South, Django migrations, Channels
What is Channels?
What is Channels?
Why Channels?
2000 2008 2015
Python 1.5 Threading 2000
Twisted 1.0 2002
WSGI (PEP 333) 2003
Python 2.6 Multiprocessing 2008
Django 1.0 2008
Eventlet / gevent 2009
Python 3.4 asyncio 2014
Python 3.5 async / await 2015
Web request handling is “solved” We have good patterns and
standards
Web request handling is easy It’s stateless, and has a
fixed response pattern
Client Server Request Response Process
Other protocols are not so easy Like WebSockets and MQTT
This is why they are more efficient No overheads of
cookies, headers and TCP handshake
Client Server Connect Data ??? Data Data Data
Writing async code is harder There’s a reason we don’t
do it all the time
Deadlocks Livelocks Race conditions Resource starvation
Simple Race Condition
Thread 1 Thread 2 if self.funds[..] < .. if self.funds[..]
< .. self.funds[..] += .. self.funds[..] -= .. self.funds[..] += .. self.funds[..] -= .. {"a": 20, "b": 0} {"a": 0, "b": 20} {"a": -20, "b": 40}
“Fixing” it, but actually adding a deadlock
Thread 1 Thread 2 get lock a get lock b
release lock b release lock a get lock b get lock a release lock a release lock b
Thread 1 Thread 2 get lock a get lock b
get lock b get lock a
More threads = more problems And hard to find in
development when you have no users
CSP “Communicating Sequential Processes” Algebra for talking about concurrency &
problems
You don’t need everything async Only the important bits
Channels: sync + async tooling Traditional synchronous Django with async
handling
“ASGI”: WSGI + async An interface that works for more
than request-response.
Goal: You mostly write sync code Channels/Django handles the annoying
part
Sync code for async behaviour
Why not just use asyncio? Do we need channels at
all?
Channels 1: Can’t write async code too Have to write
it separate outside of Channels framework
Channels 2: asyncio + sync support You can write code
as complex as you need to
Channels does not solve everything Neither does Django, the goal
is a good place to start
Working on more than just WebSocket Ways to write Django/Python
against anything with “events”
WebSockets? Emails? Chat? SMS?
What is Django in future? Is it HTTP requests forever?
Making async code easier = good Give people a way
to learn safely
Make Python the best place for these Even if it
doesn’t end up being Django.
Thanks. Andrew Godwin @andrewgodwin aeracode.org