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
870
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
240
Django Through The Years
andrewgodwin
0
130
Writing Maintainable Software At Scale
andrewgodwin
0
380
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
290
Async, Python, and the Future
andrewgodwin
2
580
How To Break Django: With Async
andrewgodwin
1
630
Taking Django's ORM Async
andrewgodwin
0
650
The Long Road To Asynchrony
andrewgodwin
0
570
The Scientist & The Engineer
andrewgodwin
1
660
Other Decks in Programming
See All in Programming
App Router 悲喜交々
quramy
7
380
メルカリ ハロ アプリの技術スタック
atsumo
2
820
デバッグの話 / Debugging for Beginners
kaityo256
PRO
8
620
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
6
1.7k
Micro Frontends for Java Microservices - dev2next 2024
mraible
PRO
0
210
[PHPカンファレンス沖縄2024]「無理なくできるだけ安全に」テストもないレガシーコードをリファクタリングするテクニック
ikezoemakoto
3
130
ML-прайсинг_на_Lamoda__вошли_и_вышли__приключение_на_20_минут__Слава_Цыганков.pdf
lamodatech
0
220
XP2024 っていう国際会議に行ってきたよの記
bonotake
4
240
Competitionsだけじゃない! Kaggle Notebooks Grandmasterのすすめ
corochann
2
590
Cancel Next.js Page Navigation: Full Throttle
ypresto
1
210
文化が生産性を作る
jimpei
3
570
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
470
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
3
230
How To Stay Up To Date on Web Technology
chriscoyier
787
250k
What's new in Ruby 2.0
geeforr
341
31k
Music & Morning Musume
bryan
46
6.1k
Fireside Chat
paigeccino
32
3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
Designing on Purpose - Digital PM Summit 2013
jponch
114
6.9k
Side Projects
sachag
452
42k
Docker and Python
trallard
40
3k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.3k
Building an army of robots
kneath
302
42k
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