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
Mesos Frameworkの作り方 (How to Make Mesos Framework)
Search
UENISHI Kota
August 04, 2016
Technology
7
2.3k
Mesos Frameworkの作り方 (How to Make Mesos Framework)
Mesos勉強会
http://connpass.com/event/36415/
で発表したスライドです
UENISHI Kota
August 04, 2016
Tweet
Share
More Decks by UENISHI Kota
See All by UENISHI Kota
Storage Systems in Preferred Networks
kuenishi
0
16
Metadata Management in Distributed File Systems
kuenishi
2
490
Behind The Scenes: Cloud Native Storage System for AI
kuenishi
2
370
Apache Ozone behind Simulation and AI Industries
kuenishi
0
350
Distributed Deep Learning with Chainer and Hadoop
kuenishi
3
1.2k
A Few Ways to Accelerate Deep Learning
kuenishi
0
1.1k
Introducing Retz
kuenishi
5
1.1k
Introducing Retz and how to develop practical frameworks
kuenishi
3
720
Formalization and Proof of Distributed Systems (ja)
kuenishi
10
6.3k
Other Decks in Technology
See All in Technology
ブラウザのレガシー・独自機能を愛でる-Firefoxの脆弱性4選- / Browser Crash Club #1
masatokinugawa
1
490
SREからゼロイチプロダクト開発へ ー越境する打席の立ち方と期待への応え方ー / Product Engineering Night #8
itkq
2
960
新卒エンジニアがCICDをモダナイズしてみた話
akashi_sn
2
250
PagerDuty×ポストモーテムで築く障害対応文化/Building a culture of incident response with PagerDuty and postmortems
aeonpeople
2
340
AWS Control Towerを 数年運用してきての気づきとこれから/aws-controltower-ops-tips
tadayukinakamura
0
170
地味にいろいろあった! 2025春のAmazon Bedrockアップデートおさらい
minorun365
PRO
1
280
SDカードフォレンジック
su3158
1
630
Devinで模索する AIファースト開発〜ゼロベースから始めるDevOpsの進化〜
potix2
PRO
8
3.5k
LangfuseでAIエージェントの 可観測性を高めよう!/Enhancing AI Agent Observability with Langfuse!
jnymyk
1
240
ビジネスとデザインとエンジニアリングを繋ぐために 一人のエンジニアは何ができるか / What can a single engineer do to connect business, design, and engineering?
kaminashi
0
120
AIでめっちゃ便利になったけど、結局みんなで学ぶよねっていう話
kakehashi
PRO
0
280
3月のAWSアップデートを5分間でざっくりと!
kubomasataka
0
130
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
19
1.1k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
For a Future-Friendly Web
brad_frost
176
9.7k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.8k
Making Projects Easy
brettharned
116
6.1k
Designing for Performance
lara
608
69k
Thoughts on Productivity
jonyablonski
69
4.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
A designer walks into a library…
pauljervisheath
205
24k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Transcript
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
Mesos Framework の作り⽅ Mesos勉強会 2016/8/4 株式会社ノーチラス・テクノロジーズ http://www.nautilus-technologies.com/ mailto:
[email protected]
Tel: 03-6712-0636 Fax: 03-6712-0664
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
2 ノーチラス・テクノロジーズ ▪会社紹介をなんか書く ▪Asakusa Frameworkという業務バッチ向けのDSLコンパイラを OSSで開発・提供しています ▪他にもいろいろ開発・提供しようとしています ▪コンパイラに詳しい⼈、データベースに詳しい⼈、分散システムに 詳しい⼈、業務に詳しい⼈、Javaに詳しい⼈などがいます
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
3 Apache Mesos: distributed systems kernel Mesosって何? 分散システムのカーネルだよ! Mesos は Linux カーネルと同じ原則で設計、開発されています。違うのは抽象化されているレベルだけです。 Mesos カーネルはあらゆるマシン上で動作し、 Hadoop, Spark, Kafka, Elastic Search といったアプリケーションに APIを通じて、データセンタ丸ごと、クラウド環境まるごとの上にリソース管理とスケジューリングを提供します。
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
4 カーネルだけでは何もできないよね! ▪⽤途に応じて好きなアプリケーションを作っていいんです ▪他の⼈が作ったライブラリ(フレームワーク)を使うもよし Linux Apache Mesos Userland Program Mesos Framework POSIX API Mesos API Computer Computers CPU scheduling, Memory allocation Etc…
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
5 Apache Mesosは何をしてくれるの? ▪リソース管理 – 管理下の全てのマシンがどのような計算資源を持っているかを把握 ▪ ⾃動認識 and ⼿動で指定 – 各種計算資源の抽象化、数字化 ▪ e.g., CPU=24, mem=128gb, disk=1024gb, gpu=4, … – 管理下のマシン(=計算資源)の死活監視 ▪スケジューリング – アプリケーションに計算資源を割り当てる (Offer) – アプリケーションが利⽤を宣⾔(Accept)した計算資源上でタスクを起動 – タスクのざっくりとした状態監視、成否の通知(Status update)
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
6 Mesosのプロセス構成 Master Agent Executor Executor Executor Executor Agent Executor Executor Executor Executor Agent Executor Executor Executor Executor •…....... Framework Scheduler C Framework Scheduler B Framework Scheduler A
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
7 タスク起動の仕組み Master Agent Executor Agent Executor Framework Scheduler 1. Resource Offer 2. Accept Offer 3. Launch Task 4. Fork & Exec 4. Fork & Exec 5. Status Update 5. Status Update •Executorは daemon でもOK •Executorは ただのコマンドでもOK •Executorは Docker イメージでもOK •Framework SchedulerはMarathonで管理
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
8 Mesos API Master Agent Executor Agent Executor Framework Scheduler 1. Resource Offer 2. Accept Offer 3. Launch Task 4. Fork & Exec 4. Fork & Exec 5. Status Update 5. Status Update Scheduler Driver API Executor Driver API Executor API Scheduler API
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
9
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
10 Spark YARN ▪基幹業務システム向けのモデリング⾔語、DSLとコンパイラなどの 開発環境 ▪基幹バッチ処理に必要なテスト・実⾏環境・運⽤環境 ▪各種データベース、データ形式のドライバも同梱 ▪各種分散処理システム、DAGエンジンに(順次)対応 n MapReduce, Spark 向けコードをAsakusaのコンパイラが⾃動⽣成・最適化 •データモデル定義 •外部システム連携 •Asakusa DSL •Operator DSL •自動テスト •バッチ実行ツール •Flow DSL •Batch DSL • MapReduce •コンパイラ •DMDL •DMDL •コンパイラ •TestDriver •ThunderGate •WindGate •Direct I/O •YAESS •EXCEL •テンプレート •実行エンジン •スモールジョブ 実行エンジン Apache Hadoop CDH MapR HDP Amazon EMR M3BP コンパイラ Asakusa: 基幹業務向けバッチ開発フレームワーク •Spark •コンパイラ
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
11 コードを変更せずにエンジンをを切り替える クラウド 分散環境 分散処理フレームワーク 商用ディストリビューション シングルノード 並列環境 並列処理 フレームワーク &実行基盤 M3BP クラウドサービス Amazon EMR Azure HDInsight データフロー DSL / コンパイラ インフラ ストラクチャ 並列・分散処理 ミドルウェア 開発 フレームワーク リファレンス実装 オンプレミス ユースケースに合わせて必要な性能特性を持ったエンジンを利用する
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
12
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
13 スケジューラがない! ▪リソーススケジューラ(ジョブスケジューラ)がないとリソース利 ⽤率が上がらない≒常に余剰リソースを抱えることになる ▪Jenkins – お、おぅ… ▪YARN – よくも悪くもHadoop系プロダクトがプライマリターゲット ▪Mesos – 完成度が⾼い、⾃由度も⾼い – エコシステムも発達 – ⾃分でスケジューラ作らないといけない
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
14 Frameworkを作ろう! ▪Frameworkを作らないとMesosを使いきったとはいえない ▪Scheduler クラスを継承してコールバックを実装 ▪Scheduler driverを叩いて命令を伝える ▪Executor クラスを継承してコールバックを実装 ▪Executor driverを叩いて命令を伝える ▪うごかす
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
15 Frameworkできたよ! ▪Retz (れつ) ▪ロゴは仮です(15分で作った) ▪いわゆる「ジョブキュー」 ▪ジョブを渡す→リソースが空いたら順番に実⾏してくれる
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
16 RetzScheduler.java import org.apache.mesos.Scheduler; import org.apache.mesos.SchedulerDriver; class RetzScheduler implements Scheduler { .. @Override public void resourceOffers( SchedulerDriver driver, List<Protos.Offer> offers) { .. // ジョブをノードに割り当てる .. driver.acceptOffers(offerIds, operations, filters); } .. } Mesos Scheduler Driver RetzScheduler Resource offer as Callback Driver call Assigned jobs as tasks JobQueue Fetch jobs
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
17 Protos.Offer ▪どこかの1台のMesos Agentが提供可能なリソース⼀覧 ▪Slave – Slave IDなど ▪Resources – CPU, メモリ, ディスク, ポート番号などAgentで設定したリソースがリ ストになっている – “ public int getCPU() “ などという⽢いメソッドはない ▪IDEの補完で雰囲気を掴もう! ▪データ構造は公式ドキュメントにJSONで掲載(Scheduler API, Executor API, Operator API)のところ
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
18 スケジューラーの起動と停⽌ ▪Driverを new, stop するだけ import org.apache.mesos.MesosSchedulerDriver; import org.apache.mesos.Protos; .. .. Protos.FrameworkInfo fw = buildFrameworkInfo(conf); RetzScheduler scheduler = new RetzScheduler(conf, fw); MesosSchedulerDriver driver = new MesosSchedulerDriver(scheduler, fw, “mesos-master:5050”); driver.start(); driver.join(); .. // ⽌めたいときは driver.stop()
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
19 RetzExecutor.java import org.apache.mesos.Executor; import org.apache.mesos.ExecutorDriver; class RetzExecutor implements Executor{ .. @Override public void launchTask( ExecutorDriver driver, Protos.TaskInfo task) { driver.sendStatusUpdate(taskStartStatus); .. // タスクを同期的に実⾏ driver.sendStatusUpdate(taskEndStatus); } .. } Mesos Executor Driver Executor Job Info as Callback Report task status LocalProcessManager Fork/exec jobs
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
20 やりたいこと ▪Mesos v1 API に対応(先週やっとリリースされてん…) ▪NUMA awareness ▪GPU対応? ▪High Availability ▪DC/OS対応 ▪ジョブの実⾏結果保存
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
21 QUESTIONS?
Copyright © 2016 Nautilus Technologies, Inc. All rights reserved. NAUTILUS
22 内容 (30min) 1. 会社紹介 2. Mesosは スケジューラとリソース管理を分離 (Resource Offer) 1. Scheduler is 何 / リソース管理 is 何 3. ⽤途に合わせてスケジューラを個別に作る 4. Asakusa Frameworkのスケジューラの歴史 … エンジンに依存し ていた 1. MapReduce … JobTracker 2. Spark … YARN 3. M3BP … ??? ▪ Retz: 作りたくないけど作るしかないか… – NUMA awareness / mesos-execute ではダメなのか? ▪ 極めて簡単なジョブキューです ▪ Roadmap: YARN / 各種コンテナ / GPGPU /