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
Taking Django Distributed
Search
Andrew Godwin
August 16, 2017
Programming
1
790
Taking Django Distributed
A talk I gave at DjangoCon US 2017.
Andrew Godwin
August 16, 2017
Tweet
Share
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
210
Django Through The Years
andrewgodwin
0
90
Writing Maintainable Software At Scale
andrewgodwin
0
330
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
250
Async, Python, and the Future
andrewgodwin
2
540
How To Break Django: With Async
andrewgodwin
1
580
Taking Django's ORM Async
andrewgodwin
0
590
The Long Road To Asynchrony
andrewgodwin
0
520
The Scientist & The Engineer
andrewgodwin
1
580
Other Decks in Programming
See All in Programming
Sheets API使ってみた
toshi0383
2
180
ts-morphを使ってコードリプレイスとASTへのハードルを下げる!
nyawach
5
330
The Design of Everyday APIs - PyCon 2024
roguelynn
1
190
The Cutting Edge Of Versioning (LambdaConf 2024)
chriskrycho
0
250
freeeのエンジニアが 就活で出そうな コーディングテストを 解説してみる
freee
1
170
Long journey of Ruby standard library RubyKaigi 2024
andpad
2
230
TypeScriptの型とパフォーマンス (TSKaigi 2024)
ypresto
14
4.6k
TypeScript 関数型スタイルでバックエンド開発のリアル
naoya
49
16k
ServerAction で Progressive Enhancement はどこまで頑張れるか? / progressive-enhancement-with-server-action
takefumiyoshii
6
510
Good first issues of TypeProf
mame
4
590
Deep Dive into React Stream/Serialize
mugi_uno
4
860
CQRS meets modern Java
simas
PRO
2
480
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
74
8.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Rails Girls Zürich Keynote
gr2m
91
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Visualization
eitanlees
137
14k
Making Projects Easy
brettharned
109
5.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
23
1.7k
Navigating Team Friction
lara
179
13k
Docker and Python
trallard
35
2.7k
Being A Developer After 40
akosma
67
580k
Side Projects
sachag
451
41k
Bash Introduction
62gerente
605
210k
Transcript
Taking Django Distributed Andrew Godwin @andrewgodwin Taking Django Distributed
Hi, I’m Andrew Godwin • Django core developer • Senior
Software Engineer at • Needs to stop running towards code on fire
Computers hate you.
This makes distributed hard.
2001: A Space Odyssey Copyright Warner Brothers
It’s time to split things up a bit. But how?
And why?
Code Databases Team
There is no one solution
Read-heavy? Write-heavy? Spiky? Predictable? Chatty?
Code
Use apps! They’re a good start! Ignore the way I
wrote code for the first 5 years of Django.
Formalise interfaces between apps Preferably in an RPC style
Split along those interfaces Into separate processes, or machines
Inventory Payments Presentation
How do you communicate? HTTP? Channels? Smoke signals?
None
None
None
None
Databases
Users Vertically Partitioned Database Images Comments
Main DB Replica Replica Replica Single main database with replication
Partition Tolerant Available Consistent
Non-consistency is everywhere It’s sneaky like that
National Museum of American History
Load Balancing
Equally balanced servers Consistent load times Similar users
Split logic Different processor loads Wildly varying users
Reqs Time
Reqs Time
W E B S O C K E T S
W E B S O C K E T S
• They can last for hours • There’s not many tools that handle them • They have 4 different kinds of failure
Design for failure, and then use it! Kill off sockets
early and often.
Team
Developers are people too! They need time and interesting things
Technical debt can be poisonous But you need a little
bit to compete
Single repo? Multiple repos? Each has distinct advantages.
Teams per service? Split responsibility? Do you split ops/QA across
teams too?
Ownership gaps They’re very hard to see.
Strategies
Don’t go too micro on those services It’s easier in
the short term, but will confuse you in the long term.
Communicate over a service bus Preferably Channels, but you get
to choose.
Work out where to allow old data Build in deliberate
caching or read only modes
Design for future sharding Route everything through one model or
set of functions
Expect long-polls/sockets to die Design for load every time, and
treat as a happy optimisation
Independent, full-stack teams From ops to frontend, per major service
Architect as a part-time position You need some, but not
in an ivory tower
2001: A Space Odyssey Copyright Warner Brothers
Maybe, just maybe, keep that monolith A well maintained and
separated one beats bad distributed
Thanks. Andrew Godwin @andrewgodwin aeracode.org