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.4k
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
27
Metadata Management in Distributed File Systems
kuenishi
2
500
Behind The Scenes: Cloud Native Storage System for AI
kuenishi
2
390
Apache Ozone behind Simulation and AI Industries
kuenishi
0
370
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
730
Formalization and Proof of Distributed Systems (ja)
kuenishi
10
6.4k
Other Decks in Technology
See All in Technology
エンジニア向け技術スタック情報
kauche
0
110
LinkX_GitHubを基点にした_AI時代のプロジェクトマネジメント.pdf
iotcomjpadmin
0
160
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
1
140
Абьюзим random_bytes(). Фёдор Кулаков, разработчик Lamoda Tech
lamodatech
0
270
CSS、JSをHTMLテンプレートにまとめるフロントエンド戦略
d120145
0
200
Oracle Audit Vault and Database Firewall 20 概要
oracle4engineer
PRO
2
1.6k
AWS Summit Japan 2025 Community Stage - App workflow automation by AWS Step Functions
matsuihidetoshi
1
140
ローカルLLMでファインチューニング
knishioka
0
120
実践! AIエージェント導入記
1mono2prod
0
130
Microsoft Build 2025 技術/製品動向 for Microsoft Startup Tech Community
torumakabe
1
200
Azure AI Foundryでマルチエージェントワークフロー
seosoft
0
140
知識を整理して未来を作る 〜SKDとAI協業への助走〜
yosh1995
0
130
Featured
See All Featured
Building Applications with DynamoDB
mza
95
6.5k
Fireside Chat
paigeccino
37
3.5k
Git: the NoSQL Database
bkeepers
PRO
430
65k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Embracing the Ebb and Flow
colly
86
4.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
We Have a Design System, Now What?
morganepeng
52
7.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
RailsConf 2023
tenderlove
30
1.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
Navigating Team Friction
lara
187
15k
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 /