$30 off During Our Annual Pro Sale. View Details »
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
4
700
Services, Architecture and Channels
A talk I gave at DjangoCon Europe 2017 in Florence, Italy
Andrew Godwin
April 03, 2017
Tweet
Share
More Decks by Andrew Godwin
See All by Andrew Godwin
Reconciling Everything
andrewgodwin
1
350
Django Through The Years
andrewgodwin
0
270
Writing Maintainable Software At Scale
andrewgodwin
0
480
A Newcomer's Guide To Airflow's Architecture
andrewgodwin
0
380
Async, Python, and the Future
andrewgodwin
2
700
How To Break Django: With Async
andrewgodwin
1
760
Taking Django's ORM Async
andrewgodwin
0
760
The Long Road To Asynchrony
andrewgodwin
0
720
The Scientist & The Engineer
andrewgodwin
1
800
Other Decks in Programming
See All in Programming
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
280
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
310
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.4k
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
220
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
420
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 2
philipschwarz
PRO
0
120
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
140
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
160
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
160
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
150
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
180
JETLS.jl ─ A New Language Server for Julia
abap34
2
460
Featured
See All Featured
Paper Plane
katiecoart
PRO
0
44k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
How STYLIGHT went responsive
nonsquared
100
6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
The browser strikes back
jonoalderson
0
130
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Being A Developer After 40
akosma
91
590k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
36
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
170
Typedesign – Prime Four
hannesfritz
42
2.9k
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