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
Services, Architecture and Channels
Search
Andrew Godwin
April 03, 2017
Programming
730
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Services, Architecture and Channels
A talk I gave at DjangoCon Europe 2017 in Florence, Italy
Andrew Godwin
April 03, 2017
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
400
Django Through The Years
andrewgodwin
0
320
Writing Maintainable Software At Scale
andrewgodwin
0
520
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
420
Async, Python, and the Future
andrewgodwin
2
740
How To Break Django: With Async
andrewgodwin
1
830
Taking Django's ORM Async
andrewgodwin
0
850
The Long Road To Asynchrony
andrewgodwin
0
770
The Scientist & The Engineer
andrewgodwin
1
860
Other Decks in Programming
See All in Programming
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
340
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.3k
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
240
dRuby over BLE
makicamel
2
410
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
230
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
380
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
290
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
250
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
990
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
13
2.2k
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.7k
Featured
See All Featured
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
310
Why Our Code Smells
bkeepers
PRO
340
58k
Color Theory Basics | Prateek | Gurzu
gurzu
0
380
Into the Great Unknown - MozCon
thekraken
41
2.6k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
エンジニアに許された特別な時間の終わり
watany
107
250k
WCS-LA-2024
lcolladotor
0
670
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Facilitating Awesome Meetings
lara
57
7k
sira's awesome portfolio website redesign presentation
elsirapls
0
290
Transcript
Andrew Godwin @andrewgodwin
Andrew Godwin Hi, I'm Django core developer Senior Software Engineer
at Apparently now does software architecture
The Monolith
The Monolith Only one version of any dependency Everything can
import everything Deployed all at once No separation Side-effects from other code
None
Services Code split up by purpose/team Defined cross-boundary API Deployed
separately Can use different versions of dependencies Isolated from each other
Why services?
Easier to manage Smaller, self-contained problems
Independent Scaling And easier performance analysis
Faster Individual Deployment Less to deploy at once
Complex Interdependencies Harder to deploy & track bugs
Requires great communication Teams need calling contracts and APIs
More points of failure Not just one set of homogenous
servers
No more quick hacks Separation forces a level of code
design
Switching To Services Or: How I Learned To Stop Worrying
And Love The Monolith
Identify the "cut points" You might need to make some
Allocate inventory Calculate Price & Charge card Finalise order Make
Order Row &
Make Order Row Allocate inventory Calculate Price Charge card Finalise
inventory Finalise order
Make Order Row Allocate inventory Calculate Price Charge card Finalise
inventory Finalise order
Define APIs between services Behave like all other teams are
third-party
Separate Datastores & Servers Make them as separate as possible
Communication & Transport
Service 2 Service 3 Service 1
Service 2 Service 3 Service 1 Direct Communication (20 services?
190 connections!)
Service 2 Service 3 Service 1 Direct with discovery Orchestrator
Service 2 Service 3 Service 1 Centralised Routing Router
Service 2 Service 3 Service 1 Message Bus
Centralised Comms Tradeoffs Distributed Comms Single point of failure Nasty
partial failures
At-least-once delivery Tradeoffs At-most-once delivery Some messages duplicated Some messages
lost
First-In-First-Out Tradeoffs First-In-Last-Out Easily backlogged Wide range of latencies
Channels & ASGI
Channel Layer Interface Server Worker Server Process 1 ASGI ASGI
Asynchronous socket handling Synchronous Django project Interface Server Worker Server ASGI ASGI Worker Server ASGI Process 2 Process 3 Process 4
Service 2 Service 3 Service 1 Channel Layer
Service Client inventory.request response.aF53Vds21
At-most-once delivery ASGI's Tradeoffs You have to design for potential
loss Low-latency but non-persistent Good for protocols, bad for important task queues Capacity, Backpressure and FIFO Informs producers quickly about pileups in the queue
Top Service-Oriented Architecture Tips
Per-request "correlation IDs" Track a set of service calls through
the stack
Feature Flag message headers Bundle them in, don't have every
service query them
Source Of Truth Each data model has a service that
owns (& caches) it
Metrics. Metrics everywhere. Both performance and network health
Design for failure Don't assume two things will both succeed
DO NOT START OFF WITH SERVICES Write separate Python libraries
instead
Thanks. Andrew Godwin @andrewgodwin