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
PyCon2013China_Bj_DAE
Search
Zoom.Quiet
December 20, 2013
Technology
0
210
PyCon2013China_Bj_DAE
http://cn.pycon.org/2013/beijing
洪强宁 DAE系统的设计
Zoom.Quiet
December 20, 2013
Tweet
Share
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
180
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
160
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
130
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
110
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
120
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
150
PyCon2014China-Zhuhai-jeff
zoomquiet
0
110
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
150
DevFest2014-Zhuhai-Polymer
zoomquiet
0
450
Other Decks in Technology
See All in Technology
CyberAgentの生成AI戦略 〜変わるものと変わらないもの〜
katayan
0
280
Phase12_総括_自走化
overflowinc
0
380
LINEヤフーにおけるAIOpsの現在地
lycorptech_jp
PRO
4
1.4k
TinyTroupeで人狼ゲームやってみた!
ueponx
0
160
2026年もソフトウェアサプライチェーンのリスクに立ち向かうために / Product Security Square #3
flatt_security
1
730
AgentCoreとLINEを使った飲食店おすすめアプリを作ってみた
yakumo
2
130
イベントで大活躍する電子ペーパー名札を作る(その2) 〜 M5PaperとM5PaperS3 〜 / IoTLT @ JLCPCB オープンハードカンファレンス
you
PRO
0
150
ABEMAのバグバウンティの取り組み
kurochan
1
150
20260321_エンベディングってなに?RAGってなに?エンベディングの説明とGemini Embedding 2 の紹介
tsho
0
130
"作る"から"使われる"へ:Backstage 活用の現在地
sbtechnight
0
230
1GB RAMのラズピッピで何ができるのか試してみよう / 20260319-rpijam-1gb-rpi-whats-possible
akkiesoft
0
660
詳解 強化学習 / In-depth Guide to Reinforcement Learning
prinlab
0
340
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
40
2.3k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
200
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Unsuck your backbone
ammeep
672
58k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
96
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Code Reviewing Like a Champion
maltzj
528
40k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.2k
Visualization
eitanlees
150
17k
Exploring anti-patterns in Rails
aemeredith
2
290
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Transcript
DAE PyCon China 2013
About Me • 洪强宁 / hongqn • 2002年开始接触Python • 2004年开始完全使⽤用Python⼯工
作 • 2006年加⼊入⾖豆瓣,现任⾸首席架 构师 • www.douban.com/people/ hongqn/ •
[email protected]
议程 • DAE是什么 • 为什么要开发DAE • DAE的架构 • DAE的特点 •
DAE的未来
None
DAE是什么
Douban Adorable Engineers
Douban Adorable Engineers Douban App Engine
Douban Adorable Engineers Douban App Engine
PaaS
Platform as a Service (PaaS)
PaaS
PaaS Private
PaaS Private Python
Current State
427 apps
427 apps 126 对外应⽤用
bubbler.labs.douban.com
m.douban.com
douban.fm
movie.douban.com
group.douban.com
code
up
花名册
精灵宝钻
…等等
每天处理 2.4 亿动态请求 5K 峰值 qps on 32 nodes
None
为什么要开发DAE
代码拆分
代码拆分 1 big svn repo (17万提交)
代码拆分 1 big svn repo (17万提交) 4602 git repo (2881
fork)
重⽤用基础设施 Proj A Proj B Proj C Proj D MySQL,
BeansDB, Memcache, MQ …
简化新项⺫⽬目启动 $ dae create $ dae serve $ dae deploy
最佳实践对 每个app开箱即⽤用
最佳实践对 每个app开箱即⽤用 持续集成
最佳实践对 每个app开箱即⽤用 持续集成 分级上线
最佳实践对 每个app开箱即⽤用 持续集成 分级上线 状态收集
最佳实践对 每个app开箱即⽤用 持续集成 分级上线 状态收集 故障报告
Scale SA
Scale SA 4
None
DAE的架构
基础公共服务 运⾏行环境 路由系统 依赖 管理 部署系统 资源管理 系统
app.yaml
pip-req.txt $ dae install flask
pip-req.txt $ dae install flask PyPI 镜像 pypi.douban.com
pip-req.txt $ dae install flask
Instance
Instance • web
Instance • web • gunicorn
Instance • web • gunicorn • service
Instance • web • gunicorn • service • gunicorn +
customized worker
Instance • web • gunicorn • service • gunicorn +
customized worker • daemon
Instance • web • gunicorn • service • gunicorn +
customized worker • daemon • zookeeper
预定义 handler • 预定义 URL • 预定义 query parameter •
预定义 message queue
两级结构 Load Balancer (nginx) Gateway (nginx) App (gunicorn) App Starter
unix socket fallback start Node 1 Gateway (nginx) App (gunicorn) App Starter Node 2
基础服务API • mysql • memcache • doubandb, doubanfs • moosefs
• beanstalkd • cdn • statsd + graphite • mail • elastic search • irc waylife 监控API调⽤用
部署 部署界⾯面 部署服务 控制命令 部署进度 节点 Load Balancer 节点 (via
websocket) ⽣生成配置 更新路由 节点 应⽤用⾃自检 更新代码 重启应⽤用
DAE升级 dev集群 (master branch) beta集群 (beta branch) stable集群 (release branch)
测试应⽤用 对内应⽤用 对外应⽤用 持续集成
None
DAE的特点
Low Overhead
Low Overhead • 资源分配 — 进程
Low Overhead • 资源分配 — 进程 • 资源隔离 — UNIX帐号
Low Overhead • 资源分配 — 进程 • 资源隔离 — UNIX帐号
• 资源限制 — 外部监控
Customizable
Customizable • 每个应⽤用从模板⽣生成nginx配置
Customizable • 每个应⽤用从模板⽣生成nginx配置 • 使⽤用 hook point 定制
Customizable • 每个应⽤用从模板⽣生成nginx配置 • 使⽤用 hook point 定制 • 或者只使⽤用⽣生成的
nginx 配置⽚片段
⾃自依赖
⾃自依赖 • 通过⼀一个应⽤用部署应⽤用
⾃自依赖 • 通过⼀一个应⽤用部署应⽤用 • 通过⼀一个应⽤用管理应⽤用
⾃自依赖 • 通过⼀一个应⽤用部署应⽤用 • 通过⼀一个应⽤用管理应⽤用 • ⼀一个应⽤用 scale 所有应⽤用
⾃自依赖 • 通过⼀一个应⽤用部署应⽤用 • 通过⼀一个应⽤用管理应⽤用 • ⼀一个应⽤用 scale 所有应⽤用 •
⼀一个应⽤用 serve 跨应⽤用的静态⽂文件
⾃自依赖 • 通过⼀一个应⽤用部署应⽤用 • 通过⼀一个应⽤用管理应⽤用 • ⼀一个应⽤用 scale 所有应⽤用 •
⼀一个应⽤用 serve 跨应⽤用的静态⽂文件 • DAE 的代码托管在⼀一个 DAE 应⽤用上
gevent
gevent • 默认启⽤用
gevent • 默认启⽤用 • ⽀支持⻓长连接,如 websocket
gevent • 默认启⽤用 • ⽀支持⻓长连接,如 websocket • 节省内存
gevent • 默认启⽤用 • ⽀支持⻓长连接,如 websocket • 节省内存 • 很多坑
gevent • 默认启⽤用 • ⽀支持⻓长连接,如 websocket • 节省内存 • 很多坑
greenify 已开源 github.com/douban/greenify
gevent • 默认启⽤用 • ⽀支持⻓长连接,如 websocket • 节省内存 • 很多坑
Service 是⼀一等公民
Service 是⼀一等公民 • Thrift
Service 是⼀一等公民 • Thrift • 在线客户端⽣生成
Service 是⼀一等公民 • Thrift • 在线客户端⽣生成 • 依赖注册
Service 是⼀一等公民 • Thrift • 在线客户端⽣生成 • 依赖注册 • 升级通知
Service 是⼀一等公民 • Thrift • 在线客户端⽣生成 • 依赖注册 • 升级通知
thriftclient 即将开源
Service 是⼀一等公民 • Thrift • 在线客户端⽣生成 • 依赖注册 • 升级通知
收集⼤大量状态数据
内置最佳实践
内置最佳实践 • 错误收集 - sentry
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成 • Code集成
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成 • Code集成 • 打包发布
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成 • Code集成 • 打包发布 • 分级上线
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成 • Code集成 • 打包发布 • 分级上线 • 服务地址实时推送
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成 • Code集成 • 打包发布 • 分级上线 • 服务地址实时推送 cfgpusher 即将开源
内置最佳实践 • 错误收集 - sentry • 在线 profile ⼯工具 •
预发布环境 • 持续集成 • Code集成 • 打包发布 • 分级上线 • 服务地址实时推送
不受限的Python环境
不受限的Python环境 • 可⽤用C扩展
不受限的Python环境 • 可⽤用C扩展 • 可⽤用 fork, subprocess, multiprocessing…
不受限的Python环境 • 可⽤用C扩展 • 可⽤用 fork, subprocess, multiprocessing… 曹娥已开源 github.com/douban/CaoE
不受限的Python环境 • 可⽤用C扩展 • 可⽤用 fork, subprocess, multiprocessing…
None
DAE的未来
⾖豆瓣所有应⽤用的平台
cgroups
离线⼤大数据计算
更好的 service 体系
跨 IDC
QoS
公有云服务?
开源?
开源!
开源!
谢谢!