SlideShare a Scribd company logo
Reactor によるデータインジェスチョン 
Pivotal ジャパン株式会社テクニカルサポートエンジニア北田顕啓 
@quitada 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
アジェンダ 
 Reactor とは? 
 データインジェスチョンとその課題 
 TcpServer によるデータインジェスチョンの実現 
 最後に… 
2 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
3 
Reactor とは? 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
Reactor とは? 
 Reactor ≠ 原子炉? 
• Spring Reactor のClojure インターフェース: 
 デザインパターンのReactor Pattern に影響をうける 
 Spring IO Platform のIO Foundation におけるJVM 
 Pivotal が提供する100% オープンソースプロダクト 
 2013 年11 月12 日にv1.0 GA リリース 
4 
Meltdown 
上で非同期イベント駆動型アプリケーションを構築する基 
盤フレームワーク 
• https://spring.io/platform 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
Getting Started をやってみた 
 ソースコード 
5 
Environment env = new Environment(); 
Reactor reactor = Reactors.reactor() 
.env(env) // our current Environment 
.dispatcher(Environment.RING_BUFFER) // The name of the default ring buffer dispatcher 
.get(); // get the object when finished configuring 
// Set a selector and register a consumer to handle events sent with a key that matches "parse” 
reactor.on(Selectors.$("parse"), new Consumer<Event<String>>() { 
@Override 
public void accept(Event<String> ev) { 
System.out.println("Received event with data: " + ev.getData()); 
} 
}); 
// Send an event to this Reactor and trigger all actions that match the given key 
for (int i=0; i < 100 ; i++) { 
reactor.notify("parse", Event.wrap("data" + new Integer(i).toString())); 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 
} 
設定値入れ物生成の 
おまじない 
Reactor インスタンス生成: 
イベントディスパッチャーは 
リングバッファーを使用 
Key-Value 型のイベントを受 
信した際のロジックを記述 
(ラムダ式も使用可能) 
100 個のイベントを投入
Getting Started 
をやってみた 
Unless otherwise indicated, these sl ides are 
© 6 
2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: 
ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 
REACTOR 
Demo 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
7 
データインジェスチョンとその課題 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
データインジェスチョン(Data Ingestion)とは? 
“データインジェスチョンは、データを後で使用したり、あるいは 
8 
データベースに格納するため、取得・取り込み・加工を行うこと 
である。この処理は、しばし個別のファイルを、その内容を編集 
したり、巨大ドキュメントに適合するようフォーマットを揃えると 
いった、改変処理を伴う。 
WhatIs.com より引用・翻訳 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
ビッグデータ時代におけるデータインジェスチョンの課題 
 日々大量に生成されるデータを、いかにしてリアルタイムに、遅延なく、データ 
インジェスチョンを行うか? 
• データ加工を行ったり、バックエンドのデータベースにデータ格納することを 
9 
考えると、それらがボトルネックとなる。 
• データ取得をイベントドリブンで非同期的に行い、当該データをキューイング、 
時間のかかる後処理を順次行えば良い。 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 
Reactor が使えそう…! 
CEP っぽい… 
北田 
Pivotal の技術で何か 
使えそうなのないかな…?
10 
TcpServer によるデータインジェスチョンの実現 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
TcpServer とは? 
 Reactor に含まれる、高速なTCP ベースのデータインジェスチョンを行うための強力 
 デフォルトのランタイムはNetty を使用しているが、他実装の使用も可能 
 コーデックサポート 
• TCP 経由で取得されるデータを変換して取り込む機構 
 Reply サポート 
11 
なサーバー側抽象レイヤー 
• 例えば、ストリームとして区切りなく流れてくる文字データを、区切り文字を与えておく 
ことによって、文字列単位で取り込む 
• データ投入クライアントに対してReply メッセージを返却 
• 姉妹品のTcpClient 使用時に有効 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
使い方- サンプルソースコードを眺めてみた 
 ソースコード 
12 
Environment env = new Environment(); 
// create a spec using the Netty-based server 
TcpServer<String, String> server = new TcpServerSpec<String, String>(NettyTcpServer.class) 
.env(env) 
.codec(StandardCodecs.LINE_FEED_CODEC) 
.listen("localhost", 15151) 
.consume(new Consumer<NetChannel<String, String>>() { 
public void accept(NetChannel<String, String> conn) { 
// for each connection, process incoming data 
conn.in().consume(new Consumer<String>() { 
public void accept(String line) { 
// handle line feed data 
} 
}); 
} 
}) 
.get(); 
server.start(); 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 
設定値入れ物生成の 
おまじない 
TcpServer インスタンス生成: 
Netty 適用 
使用コーデックは「文字列の 
区切りは改行コード」、リスン 
アドレス・ポートの設定 
コネクション確立時の 
イベントハンドリングを記述 
データ取得時のイベント 
TcpServer 起動ハンドリングを記述
Pivotal GemFire と組み合わせてみた 
 Pivotal GemFire とは?(以下、単にGemFire) 
 GemFire を使った大量ストリームデータのインジェスチョンを想定 
 Reactor TcpServer で非同期データ受信、必要なデータのみを 
13 
• Pivotal 社提供のJava ベース・インメモリ・データグリッド製品 
• 大量データを全てキャッシュへストア・データレプリケーションを 
同期的に行うオーバーヘッドにより期待したパフォーマンスがで 
ない懸念 
• そもそも、GemFire にストリームデータのインジェスチョンを行う 
API がない* 
選択的にGemFire キャッシュへストア 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 
GemFire 
キャッシュ 
GemFire 
キャッシュ 
GemFire 
キャッシュ 
データレプリケーション 
選択的にキャッシュ 
Reactor 
Reactor 
Reactor 
へストア 
大量 
ストリーム 
データ 
大量 
ストリーム 
データ 
大量 
ストリーム 
データ 
*= 最新版ではREST API はある
Pivotal GemFire 
と組み合わせて 
みた 
Unless otherwise indicated, these sl ides are 
© 14 
2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: 
ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 
REACTOR 
Demo 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
15 
最後に… 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
今日のまとめとやり残したこと 
 今日のまとめ 
• Reactor の概要紹介 
16 
• データインジェスチョンとReactor 
適用可能性について 
• TcpServer の概要紹介 
• GemFire とReactor の連携例紹介 
 やり残したこと 
• 他機能(Tuples、Streams、Promises、 
Processor サポート、 
AsyncTaskExecutor サポート、 
TcpClient)の網羅的紹介 
• Spring Framework を使ったReactor 
プログラミング 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
Reactor – 技術情報 
 Reactor - a foundation for asynchronous applications on the JVM 
• http://spring.io/blog/2013/05/13/reactor-a-foundation-for-asynchronous-applications- 
 GitHub – reacor/reactor: ソースコード、ドキュメント 
• https://github.com/reactor/reactor 
 GitHub - clojurewerkz/meltdown: Clojure インターフェース 
 Google Groups: reactor-framwork 
17 
on-the-jvm/ 
• https://github.com/clojurewerkz/meltdown 
• https://groups.google.com/forum/#!forum/reactor-framework 
Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a 
Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/

More Related Content

PPTX
〜Apache Geode 入門 gfsh によるクラスター構築・管理
PPTX
Apache Geode で始める Spring Data Gemfire
PDF
単なるキャッシュじゃないよ!?infinispanの紹介
PDF
超高速処理とスケーラビリティを両立するApache GEODE
PPTX
Apache BigtopによるHadoopエコシステムのパッケージング(Open Source Conference 2021 Online/Osaka...
PPTX
Microsoft Azure HDInsightをターゲットエンドポイントとして使用する
PPTX
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
PDF
SSDとGPUがPostgreSQLを加速する【OSC.Enterprise】
〜Apache Geode 入門 gfsh によるクラスター構築・管理
Apache Geode で始める Spring Data Gemfire
単なるキャッシュじゃないよ!?infinispanの紹介
超高速処理とスケーラビリティを両立するApache GEODE
Apache BigtopによるHadoopエコシステムのパッケージング(Open Source Conference 2021 Online/Osaka...
Microsoft Azure HDInsightをターゲットエンドポイントとして使用する
pg_bigmで全文検索するときに気を付けたい5つのポイント(第23回PostgreSQLアンカンファレンス@オンライン 発表資料)
SSDとGPUがPostgreSQLを加速する【OSC.Enterprise】

What's hot (19)

PDF
20171220_hbstudy80_pgstrom
PPTX
Apache Bigtopによるオープンなビッグデータ処理基盤の構築(オープンデベロッパーズカンファレンス 2021 Online 発表資料)
PDF
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
PDF
これからLDAPを始めるなら 「389-ds」を使ってみよう
PPTX
第8回 Tokyo Jazug Night Ignite 2017 落穂拾い Storage編
PDF
PostgreSQLレプリケーション10周年!徹底紹介!(PostgreSQL Conference Japan 2019講演資料)
PPTX
Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ(CloudNative Days Tokyo 2021 発表資料)
PPTX
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
PDF
20180217 FPGA Extreme Computing #10
PDF
Oracle Data Guard による高可用性
PDF
[db tech showcase Tokyo 2017] D21: ついに Red Hat Enterprise Linuxで SQL Serverが使...
PDF
第1回 松本勉強会 2012 05 11 - 公開版
PDF
マルチテナント化に向けたHadoopの最新セキュリティ事情 #hcj2014
PPTX
[中国地方DB勉強会] 第22回 Webアプリ開発をデータベース側から変革していく - MySQL 8.0新機能
PPTX
複数アプリケーションの プロセスとログを管理する ための新しいツールと手法
PPTX
PostgreSQLモニタリングの基本とNTTデータが追加したモニタリング新機能(Open Source Conference 2021 Online F...
PPTX
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
PPTX
Amazon EMRをターゲットエンドポイントとして使用する
PPTX
Let's Start Contributing to OpenJDK from Today!(Oracle Groundbreakers APAC Vi...
20171220_hbstudy80_pgstrom
Apache Bigtopによるオープンなビッグデータ処理基盤の構築(オープンデベロッパーズカンファレンス 2021 Online 発表資料)
[db tech showcase Tokyo 2017] D15: ビッグデータ x 機械学習の高速分析をVerticaで実現!by ヒューレット・パッ...
これからLDAPを始めるなら 「389-ds」を使ってみよう
第8回 Tokyo Jazug Night Ignite 2017 落穂拾い Storage編
PostgreSQLレプリケーション10周年!徹底紹介!(PostgreSQL Conference Japan 2019講演資料)
Anthos を使ったエンタープライズ向けクラスタの設計とアップグレード戦略のススメ(CloudNative Days Tokyo 2021 発表資料)
PostgreSQLのロール管理とその注意点(Open Source Conference 2022 Online/Osaka 発表資料)
20180217 FPGA Extreme Computing #10
Oracle Data Guard による高可用性
[db tech showcase Tokyo 2017] D21: ついに Red Hat Enterprise Linuxで SQL Serverが使...
第1回 松本勉強会 2012 05 11 - 公開版
マルチテナント化に向けたHadoopの最新セキュリティ事情 #hcj2014
[中国地方DB勉強会] 第22回 Webアプリ開発をデータベース側から変革していく - MySQL 8.0新機能
複数アプリケーションの プロセスとログを管理する ための新しいツールと手法
PostgreSQLモニタリングの基本とNTTデータが追加したモニタリング新機能(Open Source Conference 2021 Online F...
押さえておきたい、PostgreSQL 13 の新機能!!(Open Source Conference 2021 Online/Hokkaido 発表資料)
Amazon EMRをターゲットエンドポイントとして使用する
Let's Start Contributing to OpenJDK from Today!(Oracle Groundbreakers APAC Vi...
Ad

Similar to Reactor によるデータインジェスチョン (20)

PDF
20130329 rtm3
PDF
[db tech showcase Tokyo 2014] D33: Prestoで実現するインタラクティブクエリ by トレジャーデータ株式会社 斉藤太郎
PPTX
2016 February - WebRTC Conference Japan - 日本語
PDF
Prestoで実現するインタラクティブクエリ - dbtech showcase 2014 Tokyo
PDF
AWSオンリーで実現するIoTクラウド基盤
PDF
Apache Drill で JSON 形式の オープンデータを分析してみる - db tech showcase Tokyo 2015 2015/06/11
PDF
The road of Apache CloudStack Contributor (Translation and Patch)
KEY
P2Pって何?
PDF
2015 0228 OpenStack swift; GMO Internet Services
PDF
cloudpack負荷職人結果レポート(サンプル)
PDF
OpenTelemetryMeetup_2024-11_DENSO_FIoT.pdf
PDF
Treasure Data Intro for Data Enthusiast!!
PDF
OpenLineage による Airflow のデータ来歴の収集と可視化(Airflow Meetup Tokyo #3 発表資料)
PDF
マスタリング DEA/NG 第2版
PPTX
私はここでつまづいた! Oracle database 11g から 12cへのアップグレードと Oracle Database 12c の新機能@201...
PPTX
Consulによる運用自律化体験ハンズオンとConsul活用事例紹介
PDF
泥臭い運用から、プログラマブルインフラ構築(に行きたい)
PDF
Apache Hadoopの新機能Ozoneの現状
PDF
ServerlessConf Tokyo2018 サーバーレスなシステムのがんばらない運用監視
PDF
HttpとTelnetをつなぐ何か
20130329 rtm3
[db tech showcase Tokyo 2014] D33: Prestoで実現するインタラクティブクエリ by トレジャーデータ株式会社 斉藤太郎
2016 February - WebRTC Conference Japan - 日本語
Prestoで実現するインタラクティブクエリ - dbtech showcase 2014 Tokyo
AWSオンリーで実現するIoTクラウド基盤
Apache Drill で JSON 形式の オープンデータを分析してみる - db tech showcase Tokyo 2015 2015/06/11
The road of Apache CloudStack Contributor (Translation and Patch)
P2Pって何?
2015 0228 OpenStack swift; GMO Internet Services
cloudpack負荷職人結果レポート(サンプル)
OpenTelemetryMeetup_2024-11_DENSO_FIoT.pdf
Treasure Data Intro for Data Enthusiast!!
OpenLineage による Airflow のデータ来歴の収集と可視化(Airflow Meetup Tokyo #3 発表資料)
マスタリング DEA/NG 第2版
私はここでつまづいた! Oracle database 11g から 12cへのアップグレードと Oracle Database 12c の新機能@201...
Consulによる運用自律化体験ハンズオンとConsul活用事例紹介
泥臭い運用から、プログラマブルインフラ構築(に行きたい)
Apache Hadoopの新機能Ozoneの現状
ServerlessConf Tokyo2018 サーバーレスなシステムのがんばらない運用監視
HttpとTelnetをつなぐ何か
Ad

More from Akihiro Kitada (11)

PPTX
How to configure the cluster based on Multi-site (WAN) configuration
PPTX
Reactive Streams に基づく非同期処理プログラミング 〜 Reactor を使ってみた
PPTX
〜僕の初めてのリアクティブプログラミング Reactor を使ってリアクティブに昇龍拳を繰り出してみた!
PPTX
【古いスライド】〜僕の初めてのリアクティブプログラミング Reactor を使ってリアクティブに昇龍拳を繰り出してみた!
PPTX
Apache Geode の Apache Lucene Integration を試してみた
PPTX
Apache Calcite の Apache Geode Adapter を弄った
PPTX
Grafana を使った Apache Geode クラスター監視
PPTX
〜Apache Geode 入門 Multi-site(WAN)構成による クラスター連携
PPTX
My first reactive programming - To deliver a deathblow “Shoryuken” with using...
PPTX
【古いスライド】〜僕の初めてのリアクティブプログラミング Reactor を使ってリアクティブに昇龍拳を繰り出してみた!
PPTX
はじめての Cloud Foundry: .NET アプリケーションのはじめ方
How to configure the cluster based on Multi-site (WAN) configuration
Reactive Streams に基づく非同期処理プログラミング 〜 Reactor を使ってみた
〜僕の初めてのリアクティブプログラミング Reactor を使ってリアクティブに昇龍拳を繰り出してみた!
【古いスライド】〜僕の初めてのリアクティブプログラミング Reactor を使ってリアクティブに昇龍拳を繰り出してみた!
Apache Geode の Apache Lucene Integration を試してみた
Apache Calcite の Apache Geode Adapter を弄った
Grafana を使った Apache Geode クラスター監視
〜Apache Geode 入門 Multi-site(WAN)構成による クラスター連携
My first reactive programming - To deliver a deathblow “Shoryuken” with using...
【古いスライド】〜僕の初めてのリアクティブプログラミング Reactor を使ってリアクティブに昇龍拳を繰り出してみた!
はじめての Cloud Foundry: .NET アプリケーションのはじめ方

Reactor によるデータインジェスチョン

  • 1. Reactor によるデータインジェスチョン Pivotal ジャパン株式会社テクニカルサポートエンジニア北田顕啓 @quitada Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 2. アジェンダ  Reactor とは?  データインジェスチョンとその課題  TcpServer によるデータインジェスチョンの実現  最後に… 2 Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 3. 3 Reactor とは? Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 4. Reactor とは?  Reactor ≠ 原子炉? • Spring Reactor のClojure インターフェース:  デザインパターンのReactor Pattern に影響をうける  Spring IO Platform のIO Foundation におけるJVM  Pivotal が提供する100% オープンソースプロダクト  2013 年11 月12 日にv1.0 GA リリース 4 Meltdown 上で非同期イベント駆動型アプリケーションを構築する基 盤フレームワーク • https://spring.io/platform Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 5. Getting Started をやってみた  ソースコード 5 Environment env = new Environment(); Reactor reactor = Reactors.reactor() .env(env) // our current Environment .dispatcher(Environment.RING_BUFFER) // The name of the default ring buffer dispatcher .get(); // get the object when finished configuring // Set a selector and register a consumer to handle events sent with a key that matches "parse” reactor.on(Selectors.$("parse"), new Consumer<Event<String>>() { @Override public void accept(Event<String> ev) { System.out.println("Received event with data: " + ev.getData()); } }); // Send an event to this Reactor and trigger all actions that match the given key for (int i=0; i < 100 ; i++) { reactor.notify("parse", Event.wrap("data" + new Integer(i).toString())); Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ } 設定値入れ物生成の おまじない Reactor インスタンス生成: イベントディスパッチャーは リングバッファーを使用 Key-Value 型のイベントを受 信した際のロジックを記述 (ラムダ式も使用可能) 100 個のイベントを投入
  • 6. Getting Started をやってみた Unless otherwise indicated, these sl ides are © 6 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ REACTOR Demo Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 7. 7 データインジェスチョンとその課題 Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 8. データインジェスチョン(Data Ingestion)とは? “データインジェスチョンは、データを後で使用したり、あるいは 8 データベースに格納するため、取得・取り込み・加工を行うこと である。この処理は、しばし個別のファイルを、その内容を編集 したり、巨大ドキュメントに適合するようフォーマットを揃えると いった、改変処理を伴う。 WhatIs.com より引用・翻訳 Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 9. ビッグデータ時代におけるデータインジェスチョンの課題  日々大量に生成されるデータを、いかにしてリアルタイムに、遅延なく、データ インジェスチョンを行うか? • データ加工を行ったり、バックエンドのデータベースにデータ格納することを 9 考えると、それらがボトルネックとなる。 • データ取得をイベントドリブンで非同期的に行い、当該データをキューイング、 時間のかかる後処理を順次行えば良い。 Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ Reactor が使えそう…! CEP っぽい… 北田 Pivotal の技術で何か 使えそうなのないかな…?
  • 10. 10 TcpServer によるデータインジェスチョンの実現 Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 11. TcpServer とは?  Reactor に含まれる、高速なTCP ベースのデータインジェスチョンを行うための強力  デフォルトのランタイムはNetty を使用しているが、他実装の使用も可能  コーデックサポート • TCP 経由で取得されるデータを変換して取り込む機構  Reply サポート 11 なサーバー側抽象レイヤー • 例えば、ストリームとして区切りなく流れてくる文字データを、区切り文字を与えておく ことによって、文字列単位で取り込む • データ投入クライアントに対してReply メッセージを返却 • 姉妹品のTcpClient 使用時に有効 Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 12. 使い方- サンプルソースコードを眺めてみた  ソースコード 12 Environment env = new Environment(); // create a spec using the Netty-based server TcpServer<String, String> server = new TcpServerSpec<String, String>(NettyTcpServer.class) .env(env) .codec(StandardCodecs.LINE_FEED_CODEC) .listen("localhost", 15151) .consume(new Consumer<NetChannel<String, String>>() { public void accept(NetChannel<String, String> conn) { // for each connection, process incoming data conn.in().consume(new Consumer<String>() { public void accept(String line) { // handle line feed data } }); } }) .get(); server.start(); Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ 設定値入れ物生成の おまじない TcpServer インスタンス生成: Netty 適用 使用コーデックは「文字列の 区切りは改行コード」、リスン アドレス・ポートの設定 コネクション確立時の イベントハンドリングを記述 データ取得時のイベント TcpServer 起動ハンドリングを記述
  • 13. Pivotal GemFire と組み合わせてみた  Pivotal GemFire とは?(以下、単にGemFire)  GemFire を使った大量ストリームデータのインジェスチョンを想定  Reactor TcpServer で非同期データ受信、必要なデータのみを 13 • Pivotal 社提供のJava ベース・インメモリ・データグリッド製品 • 大量データを全てキャッシュへストア・データレプリケーションを 同期的に行うオーバーヘッドにより期待したパフォーマンスがで ない懸念 • そもそも、GemFire にストリームデータのインジェスチョンを行う API がない* 選択的にGemFire キャッシュへストア Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ GemFire キャッシュ GemFire キャッシュ GemFire キャッシュ データレプリケーション 選択的にキャッシュ Reactor Reactor Reactor へストア 大量 ストリーム データ 大量 ストリーム データ 大量 ストリーム データ *= 最新版ではREST API はある
  • 14. Pivotal GemFire と組み合わせて みた Unless otherwise indicated, these sl ides are © 14 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/ REACTOR Demo Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 15. 15 最後に… Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 16. 今日のまとめとやり残したこと  今日のまとめ • Reactor の概要紹介 16 • データインジェスチョンとReactor 適用可能性について • TcpServer の概要紹介 • GemFire とReactor の連携例紹介  やり残したこと • 他機能(Tuples、Streams、Promises、 Processor サポート、 AsyncTaskExecutor サポート、 TcpClient)の網羅的紹介 • Spring Framework を使ったReactor プログラミング Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/
  • 17. Reactor – 技術情報  Reactor - a foundation for asynchronous applications on the JVM • http://spring.io/blog/2013/05/13/reactor-a-foundation-for-asynchronous-applications-  GitHub – reacor/reactor: ソースコード、ドキュメント • https://github.com/reactor/reactor  GitHub - clojurewerkz/meltdown: Clojure インターフェース  Google Groups: reactor-framwork 17 on-the-jvm/ • https://github.com/clojurewerkz/meltdown • https://groups.google.com/forum/#!forum/reactor-framework Unless otherwise indicated, these sl ides are © 2013-2014 Pivotal Sof tware, Inc. and l icensed under a Creat ive Commons At tribut ion-NonCommercial l icense: ht tp: / /creat ivecommons.org/ l icenses/by -nc/3.0/