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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Eunju Amy Sohn
August 17, 2018
Programming
1
2.5k
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
430
Cloud Deep Learning for everyone
ejsohn
0
160
Microservice with go and gRPC
ejsohn
1
640
Spot Utilization for GPU Instance Cost Efficiency
ejsohn
0
110
Implementing Reactive Programming with ReSwift
ejsohn
0
220
Other Decks in Programming
See All in Programming
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
CSC307 Lecture 15
javiergs
PRO
0
250
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8.1k
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
200
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
140
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
220
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
2
370
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
400
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
110
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
150
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
220
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
770
The Invisible Side of Design
smashingmag
302
51k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
200
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.4k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
150
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
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 소수의 인원으로 빠르게 관리하기 편한 채팅 서버를
만들 수 있었습니다. + 채팅 서버의 성능에 대해 관심 있으신 분들과 이야기를 나누고 싶습니다!