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
SRE CH25 - Data Processing Pipelines (2018/03/08)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Rick Hwang
March 08, 2018
Education
3
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SRE CH25 - Data Processing Pipelines (2018/03/08)
Rick Hwang
March 08, 2018
More Decks by Rick Hwang
See All by Rick Hwang
從應用程式 Inside-Out 出發的 Web 可靠性設計 (台灣軟體工程協會, 高雄師範大學) (20250628)
rickhwang
0
64
在生命轉彎的地方 - 從軟體開發職涯,探索人生 (20231201_5)
rickhwang
0
160
雲端職涯探索日 - 探索職涯,複利人生 (20230829)
rickhwang
0
16
SRE 實踐與開發平台指南 書友見面會 (2023 0819 - 0826)
rickhwang
0
19
20230618 - 軟體測試實務新書發表會 - 從品質與測試,讓軟體再次偉大
rickhwang
0
19
CH02 API Governance
rickhwang
0
17
Chapter 8. Partial updates and retrievals
rickhwang
0
22
API Design Patterns - Ch09 Custom Methods
rickhwang
0
17
凝聚團隊共識的溝通方法 (Effective Team Communication) (20230215)
rickhwang
0
25
Other Decks in Education
See All in Education
Lectura 2 (PIT : Python Basico)
robintux
0
400
Stardy 会社紹介資料
stardy
0
4.7k
AI-Based Speaking Assessment of a Short-Term Study Abroad Program
uranoken
0
410
観察、仮説、実行、検証、計画、提案を一年で3000回トレーニングする方法/3000 Thinking Loops in 365 Days
moriyuya
4
600
生成AI時代の情報発信
molmolken
0
160
Case Studies and Future Research - Lecture 12 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
220
!コスパよくインターンに受かる方法!
ruribou
1
310
Course Review - Lecture 13 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2.3k
[2026前期火5] 論理学(京都大学文学部 前期 第13回)「走って、止まって、積み上がる」
yatabe
0
160
Portable & Reproducible Research Environments in the Age of AI Agents
denkiwakame
0
610
Fundamentos, Caracteristicas y Aplicaciones de los Modulos NumPy , Matplotlib y Pandas
robintux
0
160
JAWS-UG初心者支部#81 GWにEduJAWSと何か作ろうもくもく会!
otsuki
0
160
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Exploring anti-patterns in Rails
aemeredith
3
460
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
530
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
680
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
How to Ace a Technical Interview
jacobian
281
24k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Language of Interfaces
destraynor
162
27k
Code Review Best Practice
trishagee
74
20k
Optimising Largest Contentful Paint
csswizardry
37
3.9k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
250
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
Transcript
1
Written by Dan Dennison P311 - P322 (繁中版) Chapter 25
Data Processing Pipelines 資料處理管線 2
3
• 管線設計模式的起源 • 簡單管線設計模式與大數據 • 週期性管線模式的挑戰 • 工作分發不均造成的問題 • 分散式環境中週期性資料管線的缺點
• Google Workflow 簡介 (賣產品?) Agenda 4
管線設計模式的起源 (Origin of the PIpeline Design Pattern) • Input ->
Program -> Output • coroutine (協程) • DTSS 通訊檔案 (Dartmouth Time Sharing System) • UNIX Pipeline • ETL: Extract-Transform-Load • Big Data 5
6 出處:AWS Summit 2016: Big Data Architectural Patterns and Best
Practices
7 https://cloud.google.com/solutions/data-analytics-partner-ecosystem
8
簡單管線設計模式與大數據 (Initial Effect of Big Data on the Simple Pipeline
Pattern) • 簡單,單向管線:Simple, One-Phase Pipeline ◦ 大數據 ◦ 週期性、持續性的操作 • 多相管線 (multiphase pipeline) ◦ 便於理解系統的邏輯 ◦ 但是系統效率不一定最佳 • 深度 (depth) ◦ 一條 Pipeline 只有一個程式,深度為 1 ◦ 很深的 Pipeline 可能有數十個、數百個程式 9
10 http://www.wermac.org/valves/valves_control-valves_principles-of-operation.html 工業程序控制
11 週期性管線模式的挑戰 (Challenges with the Periodic Pipeline Pattern) • 條件:
◦ 有足夠的執行容量 ◦ 確保程式之間處理的能力一致 (CH22 處理連鎖故障) • 框架的實作:MapReduce、Flume • 週期性資料管線模式很脆弱 ◦ 相關問題: ▪ 任務執行預期 ▪ 資源耗盡 ▪ 分塊卡住,引響整個系統 ◦ 要調教以下之後才會穩定: ▪ 工作串流 ▪ 執行週期 ▪ 分快處理技術
12 Hadoop Ecosystem - 2015/06
13 工作分配不均造成的問題 (Trouble Caused By Unevent Work Distribution) • 大數據的關鍵思維:尷尬平行
(embarrassingly parallel) 演算法 ◦ 把巨大的工作,切割成可裝載在機器的小區塊 ◦ 要注意區塊的資源分配 ◦ k8s, container • 卡住的工作分塊 (hanging chunk) ◦ 資源分配不足、過量 ◦ 資料流操作困難
14
插播:想當年。。。 設計 Automation Test Framework 做的事。。。 15 https://rickhw.github.io/2017/03/18/SQA/Stages-In-Software-Testing/#Test-Framework-for-Regression
16 大量 Auto Test 在執行時的 Pipeline 面對:資源分配、執行時間、生命週期、競爭等問題
17
18 理想的資源分配
19 實際的情境
None
21 Testcase 必要的設定: • Duration: 預期最多跑多久? • Resource: 需要多少資源? •
Testcase / Testsuite 資料相依性 ◦ Database ◦ MQ ◦ FTP
22 分散式環境中 週期性資料管線的缺點 (Drawbacks of Periodic Pipelines in Distributed Environment)
• 這些工作的特點 ◦ 低優先權 ◦ 高延遲 ◦ 降低成本 ◦ 最大化機器負載 • 造成的問題 ◦ 新的工作累積 (Queue?) 在調度器上 ◦ 為了加速執行,正在執行、快要結束的工作可能被終止 • 解決方案 ◦ 提供足夠的服務容量 ◦ 計算需要的資源與取得的依賴
23
監控 週期性管線問題 • 驚群效應 (Thundering Herd Problems) ◦ CH24 分散式任務排程系統
(Cron) ◦ 每次執行,可能啟動數千個工作流程 ◦ 執行實體過載 ◦ 分散式叢集過載 ◦ 網路基礎設施過載 • 摩爾負載模式 (Moire Load Pattern) ◦ 兩個以上的管線任務執行 ◦ 共享資源消耗問題 24
驚群效應 (或稱雷鳴群體效應) • 當往一群鴿子中間扔一粒穀子,所有的各自都被驚動前來搶奪這粒食物,但是最 終註定只可能有一個鴿子滿意的搶到食物,沒有搶到的鴿子只好回去繼續睡覺, 等待下一粒穀子的到來。這裡鴿子表示程序(執行緒),那粒穀子就是等待處理的 事件。 • 問題: ◦
Context Switch: CPU 花很多時間在 Thread 之間切換 ◦ 主程序建立了socket、bind、listen之後,fork()出來多個程序,每個子程序都開始迴圈處理(accept)這 個listen_fd。每個程序都阻塞在accept上,當一個新的連線到來時候,所有的程序都會被喚醒,但是其 中只有一個程序會接受成功,其餘皆失敗,重新休眠。 • 解決 ◦ nginx: epoll 25
26 Moiré load pattern in shared infrastructure Moiré load pattern
in separate infrastructure
27
Google Workflow 簡介 • 一次性批次處理管線需求越來越多 • Google 2003 年開發的 ◦
實現超大規模交易性資料流 ◦ 僅執行一次 (exactly-once) 28
Workflow as Model-View-Controller Pattern 29
Workflow as Model-View-Controller Pattern 30 • Model (模型): 主作業處理程序 ◦
將任務儲存在記憶體中 ◦ 將每次修改以日誌方式記錄在持久磁碟上 ◦ 只儲存特定工作的指標 • View (視圖): 工作流程 ◦ 視同整個管線子元件 ◦ 不停向 Model 更新他們所見的系統狀況 • Controller (控制器): 輔助活動 ◦ 即時伸縮管線 (runtime scaling of the pipeline) ◦ 執行狀態快照 (snapshotting) ◦ 管理工作週期 (workcycle state control) ◦ 回溯管線狀態 (rolling back pipeline state) ◦ 緊急時刻停止系統一切行為 (performing global interdiction for business continuity)
31
Workflow 的執行階段 • 將工作流程拆分更小的任務組 ◦ 可以對小區塊資料操作 ◦ 任意階段輕易的實現對應、重組、排序、分割、合併 • 工作流程可以有多個平行實例
(Instance) • 工作的流程可以自我調度,選擇不同類型工作執行 32
Workflow 正確性保證 • 組態檔保障工作流程輸出與設定一致 • 工作結果由當前擁有租約的處理程序提交 • 工作流程輸出檔案具備唯一命名 (unique) •
用戶端與伺服器每次執檢查 token 33
保障業務的持續性 • 可靠度:光纖被切斷、天氣狀況、連鎖性故障 • 透過 Spanner 儲存日誌,利用其 Global 的特性 34
保障業務的持續性 35
36
Solutions • K8s Jobs • Apache Airflow • GCP Dataflow
37
• 週期性 管線資料 很有價值 • 資料本身是持續性、自然成長,就不要採用週期性設計,而是利用 Workflow 特 典設計 小結
38
39 Questions? • 大家的系統有類似 Pipeline 的 Task? • 這些 Task
的每個程序可以單獨執行? • Pipeline Input / Output 資料放哪?