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.4k
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
370
Cloud Deep Learning for everyone
ejsohn
0
150
Microservice with go and gRPC
ejsohn
1
560
Spot Utilization for GPU Instance Cost Efficiency
ejsohn
0
87
Implementing Reactive Programming with ReSwift
ejsohn
0
180
Other Decks in Programming
See All in Programming
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
220
CNCF Project の作者が考えている OSS の運営
utam0k
5
550
Swiftコンパイラ超入門+async関数の仕組み
shiz
0
190
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
420
Scaling your build logic
antalmonori
1
130
GitHub CopilotでTypeScriptの コード生成するワザップ
starfish719
28
6.1k
ASP.NET Core の OpenAPIサポート
h455h1
0
150
AWS re:Invent 2024個人的まとめ
satoshi256kbyte
0
140
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
940
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
250
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
250
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
130
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Rails Girls Zürich Keynote
gr2m
94
13k
Fireside Chat
paigeccino
34
3.2k
Raft: Consensus for Rubyists
vanstee
137
6.7k
The Cult of Friendly URLs
andyhume
78
6.2k
Optimising Largest Contentful Paint
csswizardry
33
3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Making the Leap to Tech Lead
cromwellryan
133
9k
Designing for Performance
lara
604
68k
Building Your Own Lightsaber
phodgson
104
6.2k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
For a Future-Friendly Web
brad_frost
176
9.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 소수의 인원으로 빠르게 관리하기 편한 채팅 서버를
만들 수 있었습니다. + 채팅 서버의 성능에 대해 관심 있으신 분들과 이야기를 나누고 싶습니다!