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
40만명이 쓰는 Django channels 채팅서버, 우리는 어떻게 만들었나?
Search
Eunju Amy Sohn
August 17, 2018
Programming
1
2.3k
40만명이 쓰는 Django channels 채팅서버, 우리는 어떻게 만들었나?
2018 Pycon. @EJSohn
Eunju Amy Sohn
August 17, 2018
Tweet
Share
More Decks by Eunju Amy Sohn
See All by Eunju Amy Sohn
내가 커뮤니티 스피킹을 하는 이유
ejsohn
1
350
Cloud Deep Learning for everyone
ejsohn
0
150
Microservice with go and gRPC
ejsohn
1
540
Spot Utilization for GPU Instance Cost Efficiency
ejsohn
0
84
Implementing Reactive Programming with ReSwift
ejsohn
0
170
Other Decks in Programming
See All in Programming
C++でシェーダを書く
fadis
6
4.1k
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.2k
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.3k
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Jakarta EE meets AI
ivargrimstad
0
240
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
The Language of Interfaces
destraynor
154
24k
Thoughts on Productivity
jonyablonski
67
4.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Bash Introduction
62gerente
608
210k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Music & Morning Musume
bryan
46
6.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Embracing the Ebb and Flow
colly
84
4.5k
Transcript
40만명이 쓰는 Django channels 채팅서버, 우리는 어떻게 만들었나? Pycon Korea
2018 Eunju Sohn (Amy)
Name: 손은주 Nickname: Amy Who: Devops Engineer @Mathpresso Comment: I
love The magical moment! github: http://github.com/EJSohn email:
[email protected]
Contents 1. Why? 1. background explanation 2. introduce Django channels
2. How? 1. server-client communication protocol 2. coding 3. testing 4. deployment & maintenance
Why? Slack – Java Facebook Messenger – Erlang Line –
Java, C++, Erlang Kakaotalk – C++ Snapchat – Java * 구글링 첫 페이지에 나온 정보들입니다. 신뢰도가 그리 높지 않습니다 ㅠ
Why? – background explanation Mathpresso Dev Team
Why? – background explanation Main language: Python + deeply use
Django ORM + fast action and output required + but all thing has to be maintainable and scalable Had to make Reliable app Faster, with existing technical stack
Why? – background explanation
Why? – Django channels
Why? – Django channels • ASGI • Asynchronous webserver •
Consumer • Daphne • Channel layer
Why? – Django channels ASGI? = Asynchronous Server Gateway Interface
Spiritual successor of wsgi. Extend not only support HTTP-style request/response but also websocket and others.
Why? – Django channels myapp/myapp/asgi.py
Why? – Django channels
Why? – Django channels Daphne HTTP request websocket request mysite.urls
mysite.routing
How? – server-client communication protocol
How? – server-client communication protocol Requirement User – Bot 1:1
chatting with multiple templates User – User 1:1 chatting User group chatting
How? – server-client communication protocol Had to build communication protocol
& • Communicating text, byte-data based pre-defined json. • Serializing& deserializing into object.
How? – coding
How? – coding Store chat data in NoSQL
How? – coding async/await Remove all I/O bottleneck • Network
I/O • Database I/O
How? – coding aiohttp
How? – coding database_sync_to_async
Why? – testing pytest-asyncio HTTPCommunicator WebsocketCommuniator
Why? – testing Chat-client https://github.com/websocket-client/websocket-client
How? – deployment & maintenance machine daphne nginx Load balancer
80 endpoint1:80 endpoint2:80
Why? – conclusion 소수의 인원으로 빠르게 관리하기 편한 채팅 서버를
만들 수 있었습니다. + 채팅 서버의 성능에 대해 관심 있으신 분들과 이야기를 나누고 싶습니다!