SlideShare a Scribd company logo
1
春の嵐を巻き起こせ
Storm補完計画
(概要編)
2
第壱話
ス
ト
ー
ム 襲来、
3
Stormとは
 ビックデータのリアルタイム分散並列処理を簡単
に行うためのフレームワーク
 もともと米BackType社(ソーシャルメディア解析
企業)がつぶやき解析システムとして開発
 2011年7月にTwitter社が買収しオープンソース化
 Clojureで実装されており、連続的に発生するデ
ータを、継続的に処理し続けるフレームワーク
4
Stormの背景
でもHadoopって基本的にバッチ処理で、リアルタイム
のニーズにはミスマッチングではないか
リアルタイム並列処理ならキューイング+非同期処理
がセオリー
それだと信頼性とか拡張性の担保が大変でいかん
そもそもビックデータ処理はHadoopが有名
そんな悩みを解決するフレームワーク
5
Storm
6
Stormの6つの特徴
1.シンプル
StormのAPIは非常にシンプル
複雑な分散処理など特に意識することなく、システムを
開発可能
2.拡張性
Stromは膨大な数のメッセージに対しても低レイテンシを
維持しつつ、スケール可能
スケールするためには、マシンを増設して処理の並列数
を増やすだけでOK
プログラムを改修する必要はなし
7
Stormの6つの特徴
3.耐障害性
データ処理中に障害が発生し、ノードがダウンした場合
でも、Stormは必要に応じてタスクの再割当てやノードの
再起動を行う
そのため、処理が完全に停止してしまうことがなく、デ
ータ処理をし続けることが保証される
4.データ欠損無しの保障
何らかの理由により、データの処理に失敗したり、タイ
ムアウトが発生した場合でも、Stromはそれを検知し、再
処理する仕組みがある
これにより全てのメッセージが処理されることを担保す
る
8
Stormの6つの特徴
5.プログラム言語非依存
Storm自体は内部でClojureという言語で実装されている
が、Java、Scala、Ruby、Python、Perl、JavaScript、
PHP等の様々な言語で開発可能
6.簡単なデプロイと運用
Stormは簡単にデプロイし、動作させることが可能
システム構成もわずかな設定で変更でき、Amazon EC2な
どのクラウド環境でも動作できる
9
以上6つが主な特徴
10
11
ぶっちゃけ何ができるの?
12
Stormができること
其の壱 継続的な並列処理
• Stormの基本的な機能
• 通常はストリームデータであるメッセージを一時的
メッセージキューに保存し、そのメッセージを継続
的、かつ並列的に処理し続ける
13
Stormができること
其の弐 グルーピング
• メッセージは特定のルールに従って、グルーピング
して処理できる
最も頻繁に使われる方法が、ShuffleGrouping
各Boltすべてが等しい数のTupleを受け取るように、TupleがランダムにBolt
タスクへ送信される。
FieldsGrouping
指定されたフィールドの値によってグルーピングされる
Tupleの1つ以上のフィールドを使って、同じ値を持つTupleは必ず同じBolt
に送信されるようになる。
AllGrouping
受信Boltのすべてに各tupleのコピーが複製され送信される。
使い方には注意が必要
それ以外にも全6種類のグルーピングとカスタムグルーピングがある
14
Stormができること
其の参 トランザクション
• Stormはメッセージが必ず処理されることを保証す
るが、障害が発生し、メッセージが再送された場合、
重複して処理される可能性がある
• たった1度だけの処理としたい場合は、
Transactional Topologies機能を使用する
• すると、メッセージにはトランザクションIDが自動
で付与され、Spout/boltの処理を一つのトランザク
ションの処理として扱うことができる
15
以上
Stormができる主な機能は3つだけ
継続的な並列処理
グルーピング
トランザクション
Stormができること
16
ここまで駆け足できましたが
17
知らない用語ばかりだ…
18
第弐話
見
知
ら
ぬ 用語、
19
用語の説明も踏まえ
Stormの内部を簡単に見てみる
20
Stormの基本アーキテクチャと用語
ここからが本番
クラスタの要素
タスクを実行するプロセス
Topologyのサブセットを実行
21
Stormの基本アーキテクチャと用語
Stormのプロセス構成
Stormは複数マシンにまたがって動作する
それら全体を「クラスタ」と呼ぶ
クラスタは基本的にMaster-Slave構成となる
Nimbus
クラスタ内におけるMasterノードであり、SupervisorやWorkerプ
ロセスの管理を行う
クラスタ内におけるSlaveノードであり、タスク(SpoutやBolt)が該当
アサイン待受や、Workerプロセスの起動/停止を行う
ZookeeperはApacheFoundationのプロダクトの1つとして開発された
StormではNimbusとSupervisor間の協調管理に用いられる
Worker
Supervisor
Zookeeper
22
Stormの基本アーキテクチャと用語
クラスタを具体的に図にすると
Nimbus
Supervisor
Zookeeper
Stormクラスタ
Nimbus
StormクラスタのMasterノード
・Workerプレセスへのタスクの割り振り
・Workerプロセスのモニタリング
StormクラスタのSlaveノード
・タスクアサイン待ち受け
・Workerプロセスの起動/停止
Supervisor
Zookeeper
Worker
NimbusとSupervisoer間の協調
・各ノードで動作するデーモンの状態管理
タスクを実行するプロセス
・Topologyのサブセットの実行
Zookeeper
Zookeeper
WorkerWorkerWorker
Supervisor
WorkerWorkerWorker
Supervisor
WorkerWorkerWorker
Supervisor
WorkerWorkerWorker
23
Stormの基本アーキテクチャと用語
続いて
ここからが本当の
本番
Topologyの要素
Streamの変換処理を行う
単一または複数のStreamからTupleを受信し、加工したうえで新たな
Streamにメッセージの送信を行う
24
Stormの基本アーキテクチャと用語
Stormのアプリケーション構成
Storm上で動作するアプリケーションをTopology(トポロジー)
TopologyはSpoutとBoltからなるネットワーク構成
Tuple
Stormで処理されるメッセージ
integer,long,byte,string等標準的な型をサポート
途切れずに連続するTupleを意味する
どのようなTupleが流れるかはグルーピング機能により決定
Streamのソースとなるもので、外部からデータを取得したり、受け付け
たりしてTupleを生成/送出を行う
Stormの起点となる要素Spout
Stream
Bolt
25
Stormの基本アーキテクチャと用語
Topologyを具体的に図にすると
Topology(トポロジー)
Spout & Boltからなるネットワーク構造
Spout
Bolt
Bolt
26
Stormの基本アーキテクチャと用語
さらにStormを利用したシステム全体像を図にすると
イベント
メッセー
ジキュー
(イベントの一時保存)
RDBや
KVS
ユーザへ通知
ユーザへ通知
①イベント受付 ②イベント処理 ③結果の処理
27
Stormの基本アーキテクチャと用語
つまるところ
28
Stormの基本アーキテクチャと用語
TopologyがStorm処理の心臓
29
だから今日はTopologyだけ
覚えていってね
30
第参話
Topologyと
実
行
31
Topologyの構築
// 新規のTopologyを生成
TopologyBuilder builder = new TopologyBuilder();
// Spout を設定
builder.setSpout(“spout1", new TestWordSpout(true), 5);
builder.setSpout(“spout2", new TestWordSpout(true), 3);
// Bolt を設定
builder.setBolt(“bolt1", new TestWordCounter(), 3)
.fieldsGrouping("spout1", new Fields("word"))
.fieldsGrouping(“spout2", new Fields("word"));
// Topologyの設定を指定
Map conf = new HashMap();
conf.put(Config.TOPOLOGY_WORKERS, 4);
// TopologyをStormのクラスタへ登録
StormSubmitter.submitTopology("mytopology", conf, builder.createTopology());
http://www.slideshare.net/AdvancedTechNight/twitterstorm
Spout、Bolt共に
スレッド数を指定
Worker数を“4”で指定
(1つのSupervisorで
起動する最大Work
Topologyの構築は非常に簡単(分散処理を、これだけで実現)
とのこと(苦笑)
32
ということで
ワードカウントで実行イメージ例
33
Topologyの実行イメージ
http://www.slideshare.net/AdvancedTechNight/twitterstorm
34
実行イメージを元に
Topologyを
おさらいしてみる
35
Topologyのおさらい
http://www.slideshare.net/AdvancedTechNight/twitterstorm
36
Topologyのおさらい
http://www.slideshare.net/AdvancedTechNight/twitterstorm
☚これが
37
Topologyのおさらい
Spout
データを取得 → Tuple生成 → Tuple送信
スパウト
38
Topologyのおさらい
http://www.slideshare.net/AdvancedTechNight/twitterstorm
こいつらが
39
Topologyのおさらい
Boltボルト
Tuple受信 → 処理・加工 → Tuple送信
40
Topologyのおさらい
http://www.slideshare.net/AdvancedTechNight/twitterstorm
やり取りされてるこいつらが
41
Topologyのおさらい
Tupleタプル
Stormでやり取りされるデータ
連続したTupleのことをStream
42
Topologyのおさらい
http://www.slideshare.net/AdvancedTechNight/twitterstorm
この辺りの
機能が
43
Topologyのおさらい
グルーピング
機能
いろいろ種類がある
44
Topologyわかってきました?
45
第
四
話
Hadoop
vs
Storm
46
HadoopとStorm比較
Stormの構成はHadoopと比較すると
わかりやすい
47
HadoopとStorm比較
ただし、StormはHadoopと競合するものではない
導入するシステムの特性を見極め、使い分けるこ
とが重要
Hadoop Storm
対象 バッチ処理 リアルタイム処理
実行 • 巨大で有限なジョブ
• たくさんのデータを一度だけ
処理する
• 長い待ち時間
• 小さい無限のジョブ
• 無限のストリームデータを連
続して処理する
• 短い待ち時間
処理構成 MapReduce
→Mapper + Reducer
Topology
→Spout + Bolt
ノード JobTracker
TaskTracker
Nimbus
Supervisor
48
まとめ
Stormはリアルタイム分散並列処理を継続的
に行うフレームワーク
• シンプル
• 拡張性
• 耐障害性
• データ欠損なしの保障
• プログラム言語非依存
• 簡単なデプロイと運用
Stormを構成する要素
クラスタ/Topology/Stream/Tuple/Spout/Bolt
6つの特徴
49
ご清聴、
ありがとうございました
参考文献
• SoftwareDesign(2013年6月号)
• Twitterのリアルタイム分散処理
システム「Storm」入門
http://www.slideshare.net/Adva
ncedTechNight/twitterstorm

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

[社内勉強会]春の嵐を巻き起こせ Storm補完計画