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
20
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
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.4k
Other Decks in Technology
See All in Technology
Kaigi Effect 2025 #rubykaigi2025_after
sue445
0
130
Sleep-time Compute: LLM推論コスト削減のための事前推論
sergicalsix
1
130
自動化の第一歩 -インフラ環境構築の自動化について-
smt7174
1
130
Part1 GitHubってなんだろう?その2
tomokusaba
2
760
名単体テスト 禁断の傀儡(モック)
iwamot
PRO
1
260
Google Cloud Next 2025 Recap アプリケーション開発を加速する機能アップデート / Application development-related features of Google Cloud
ryokotmng
0
210
Docker Compose で手軽に手元環境を実現する / Simplifying Local Environments with Docker Compose #CinemaDeLT
nabeo
0
170
Azure & DevSecOps
kkamegawa
2
180
Azure × MCP 入門
ry0y4n
8
1.7k
250510 StepFunctionのテスト自動化始めました vol.1
east_takumi
1
230
LLM アプリケーションのためのクラウドセキュリティ - CSPM の実装ポイント-
osakatechlab
0
420
MagicPodが描くAIエージェント戦略とソフトウェアテストの未来
magicpod
0
230
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
5.5k
How to Ace a Technical Interview
jacobian
276
23k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
13
840
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.4k
Optimizing for Happiness
mojombo
378
70k
A Tale of Four Properties
chriscoyier
159
23k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
137
33k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
600
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Making the Leap to Tech Lead
cromwellryan
133
9.3k
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 /