Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PyCon2014China-Zhuhai-bpm.py
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Zoom.Quiet
November 17, 2014
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PyCon2014China-Zhuhai-bpm.py
141115 in Zhuhai
http://zoomq.qiniudn.com/CPyUG/PyCon2014China/141115zh-pm1-bpm.py.MP3
Zoom.Quiet
November 17, 2014
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
220
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
190
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
170
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
170
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
180
PyCon2014China-Zhuhai-jeff
zoomquiet
0
160
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
220
DevFest2014-Zhuhai-Polymer
zoomquiet
0
510
TEDxJLUZH MOMENT future
zoomquiet
0
480
Other Decks in Technology
See All in Technology
基本から分かる!AWSセキュリティ運用の考え方と任せ方
cmusudakeisuke
1
480
JAWSコミュニティに 参加して1年経った結果
ssakita
0
120
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
1
220
仕様と現実の間で落とし所を探るリモートMCPの認証・認可 — Sansanの認証基盤における課題と実践
sansantech
PRO
2
230
新米を「売り越さない」、Aurora DSQLで作る在庫ゼロ死守の限定ドロップEC
yama3133
0
200
SREのためのFinOps入門
muziyoshiz
2
1.1k
【dbts2026】AIエージェントの 判断と探索を変える、 データベース エンジニアリング― 既存DBの処理と依存関係から作る、オペレーショナルオントロジー ―
shisyu_gaku
0
280
AWS Quick 入門 | 目指せ Quick マスター 01
inariku
PRO
2
290
Content Mapper APIの応用例~CSS Modules、言語ファイル~
uhyo
2
630
Building Audio Plugin Ecosystem for Android in 2026
atsushieno
2
160
MCPでAIが自分で調べに行く
cdataj
0
140
セキュリティ専任チームなしで攻撃を先回りするSREが実践したSIEM on Amazon OpenSearch Service
cscengineer
PRO
1
740
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.9k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
440
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Design in an AI World
tapps
1
390
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
770
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
760
The Cult of Friendly URLs
andyhume
79
7.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Documentation Writing (for coders)
carmenintech
77
5.6k
How GitHub (no longer) Works
holman
316
150k
Designing Powerful Visuals for Engaging Learning
tmiket
1
650
Transcript
None
芯雲流程引擎 使用Python协程解决阻塞问题
[email protected]
Service Orchestration DNS 系统 接入层 系统 告警 系统 配置管理 系统
Game Server SA 系统 IaaS 系统 官网 系统
Python with @task
阻塞问题 result = call_func() result 无法立即获得,所谓“阻塞”
I/O 阻塞 bytes = tcp_socket.recv(4096) 网络I/O操作需要时间,所谓“I/O 阻塞”
例子 连接 发送 接收
回调 def on_received(bytes): ….. def on_sent(sock): sock.recv(on_received) def on_connect(sock): sock.send(‘xxx’,
on_sent) connect(‘a.b.c.d’, on_connect) 上下文
CALLBACK HELL
Logic Locality 最小化开发人员阅读流程代码的眼球移动距离
协程可以表达I/O阻塞 def some_process(): sock = connect(‘a.b.c.d’, on_connect) sock.send(‘xxx’) bytes =
sock.recv(on_received) …. 上下文 locals()
流程阻塞 ip = res.request_new_server(model=’B6’) 调用“外部系统”需要时间,所谓“流程阻塞”
流程阻塞 yes_no = smcs.wechat_approve(‘reboot?’) 人工审批需要时间,所谓“流程阻塞”
协程也可以表达流程阻塞 def some_process(): ip = res.request_new_server(model=’B6’) yes_no = smcs.wechat_approve(‘deploy %s?’
% ip) if yes_no: ijobs.exec_job(‘deploy’, ip)
流程引擎 申请机器 部署 修改DNS 引擎 流程
各式Event Loop 连接 发送 接收 event loop 协程 gevent tulip
/ asyncio tornado evergreen eventlet
所谓Event Loop def some_process(): sock = connect(‘a.b.c.d’, on_connect) sock.send(‘xxx’) bytes
= sock.recv(on_received) …. 协程 Event Loop fd_map = {} [fd, read] => coroutine 操作系统 select kqueue epoll recv好了告诉我, 我先睡你那了 select(sock, EV_READ) fd 132 可读了 fd 132 对应的协程醒醒 开读了
协程可以存数据库的 def some_process(): ip = res.request_new_server(model=’B6’) yes_no = smcs.wechat_approve(‘deploy %s?’
% ip) if yes_no: ijobs.exec_job(‘deploy’, ip) 协程 引擎 event_map = {} event => coroutine 外部系统 审批好了告诉我, 我先睡你那了 wechat approve 审批结果有了 审批好了,协程醒醒 开工了 mysql import cPickle bytes = cPickle.dumps(coroutine)
Python协程实现 • yield • stackless python / pypy • greenlet
/ python-fibers / stacklet / libgevent
Ultimate Coroutine Scheduler • 语言:Java for true parallelism • 协程:co-routine
with bytecode weaver • I/O阻塞:包装NIO • 流程阻塞:event map,持久化可选 https://github.com/taowen/daili
协程大法好 招聘:
[email protected]