SlideShare a Scribd company logo
1 of 55
Download to read offline
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Embed Ruby
アプリケーションへの
Rubyインタープリターの組み込み
須藤功平
株式会社クリアコード
東京Ruby会議11
2016-05-28
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Speaker's award
Continuous
development
award
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
受賞者
cedlemo
Continuous development award
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
受賞理由
2015年1月から継続的に
Ruby-GNOME2の開発に
参加しているから
一発すごい改善をした人よりも
地味でも継続的に改善している人を評価したい
Continuous development award
cedlemo
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
宣伝
OSS Gate
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
OSS Gate
OSS開発に
参加する人を
増やす取り組み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
背景
OSS利用は当たり前になった
→OSS利用者増加✓
✓
開発参加者も増えるといいな
→OSS増加✓
✓
OSS Gate
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
OSS開発参加
すごい改善じゃなくていい✓
バグレポートとかでいい
typo見つけました!とかでもいい✓
サンプルを更新とかでもいい✓
✓
OSS Gate
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
OSS Gate参加の動機
人それぞれでいい
OSS Gate
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
私の動機
ユーザーが自由に使える
ソフトウェアが増えるといいな
✓
自由に使える例:
コードを読んで学習できる✓
今日聞いた話の実装を確認できる!✓
✓
OSS Gate
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
興味ある?
興味?(重要:動機不問)
OSS開発に参加したい!✓
OSS開発参加者を増やしたい!✓
✓
5階でワークショップ開催中
説明や見学は私に一声かけて✓
✓
OSS Gate
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
本題
Rubyの組み込み
(CアプリケーションへのRubyインタープリターの組み込み)
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
動機
柔軟な記述力が欲しい✓
Cの速さが欲しい✓
Ruby以外の言語とも連携したい
Pythonも組み込む✓
✓
なんかカッコいい✓
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
別の実現方法
拡張ライブラリー
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
組み込みと拡張ライブラリー
C
Ruby
Ruby
C
Ruby組み込み
拡張
ライブラリー
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
拡張ライブラリー
実現可能:
柔軟な記述力が欲しい✓
Cの速さが欲しい✓
✓
実現不可能:
Ruby以外の言語とも連携したい✓
なんかカッコいい感✓
✓
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
実現方法の選び方
基本は拡張ライブラリー✓
すでにあるアプリなら組み込み✓
選びたい方があるならそっち✓
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
組み込みを選ぶ時の注意
それなりの覚悟が必要
利用例があまりない
問題遭遇確率が高い✓
✓
問題遭遇時:
自分でソースを読んで調べる✓
詳しい人に相談
ささださん<できればサポートを強化したい
✓
✓
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
組み込み方を紹介
実例
milter manager
Since 2008
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
milter manager
メール
サーバー
milter
manager
メール
フィルター
メール
フィルター
メール
フィルターmilter
Ruby
milterを管理するmilter
サーバープロセス
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Ruby組み込みの実装
初期化✓
fork対応✓
イベントループとシグナル✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
初期化:GC関連
{
/* スタックの底を設定 */
/* GC時にCのローカル変数に代入されている
Rubyのオブジェクトをマークするため */
RUBY_INIT_STACK;
/* ... */
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
スタックとマーク対象
{
RUBY_INIT_STACK;
/* ... */
{
VALUE object = rb_ary_new(); /* マーク対象 */
}
}
{
VALUE object = rb_ary_new(); /* マーク対象外 */
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
確認例
#define MARKED_P(object) rb_objspace_marked_object_p(object)
{
RUBY_INIT_STACK;
{
VALUE object = rb_ary_new();
/* GC.start(immediate_sweep: false) */
printf("%dn", MARKED_P(object)); /* => 1 */
}
}
{
VALUE object = rb_ary_new();
/* GC.start(immediate_sweep: false) */
printf("%dn", MARKED_P(object)); /* => 0 */
}
スライドのリポジトリー:examples/gc.c
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
GC関連の注意
{
RUBY_INIT_STACK;
/* Rubyのオブジェクトを触る
Cのコードはこのブロック内でだけ使うこと */
/* Cからのコールバックで
Rubyのコードを呼び出すときは注意 */
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
初期化:シグナル関連
{
RUBY_INIT_STACK;
/* シグナルハンドラーを保存 */
ruby_init(); /* Rubyがシグナルハンドラーを登録 */
/* シグナルハンドラーを復帰 */
/* シグナルはアプリで処理したいから */
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
シグナル復帰例
{
/* 他のシグナルも同様に復帰 */
void (*sigint_handler)(int);
sigint_handler = signal(SIGINT, SIG_DFL);
ruby_init();
signal(SIGINT, sigint_handler);
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
初期化:引数の処理
{
/* ...ruby_init()... */
static char *argv_raw[] = {"milter-manager", "-e;"};
int argc;
char **argv;
argc = sizeof(argv_raw) / sizeof(char *);
argv = argv_raw;
ruby_incpush(/* ... */); /* $LOAD_PATHの設定 */
/* 中でいろいろ初期化するのでダミーの引数で呼ぶ */
ruby_process_options(argc, argv);
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
初期化:アプリの初期化
{
/* ...ruby_process_options()... */
/* require中に例外が発生してもここで止める */
/* ここで止めないと例外を受け取る人がいなくて
クラッシュ */
rb_protect(/* rb_require("milter/manager") */);
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
milter managerとRuby
組み込み処理系の1つ
Pythonも使えるようにしたかった
結局Ruby必須でPython対応はしなかった
✓
✓
起動後にdlopen()で動的にsoを
読み込んで組み込み
✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
起動時に動的に組み込み
milter
manager
Ruby
milter
manager
Ruby
起動前 起動 起動後
milter
manager
Ruby
dlopen()
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
起動時にso読んで組み込み
{
/* ↓GC用 */
RUBY_INIT_STACK;
/* 動的にsoを読んで初期化関数を呼ぶ */
/* dlopen();
init = dlsym();
init(); ←の中でruby_init();とか */
/* アプリの処理 */
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
RUBY_INIT_STACK!?
{
/* ↓アプリ側で呼ぶの!? */
RUBY_INIT_STACK;
/* 動的にsoを読んで初期化関数を呼ぶ */
/* dlopen();
init = dlsym();
init(); ←の中でruby_init();とか */
/* アプリの処理 */
}
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
アプリにーlruby…
milter
manager
Ruby
milter
manager
Ruby
起動前 起動 起動後
milter
manager
Ruby
dlopen()
-lruby
カッコわるい。。。
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Ruby組み込み時の意気込み
本体に組み込む✓
動的に組み込もうとしない✓
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Ruby組み込みの実装
初期化✓
fork対応✓
イベントループとシグナル✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
milter manager利用例
大学・企業
ユーザー数:数百〜数万人✓
✓
プロバイダー
ユーザー数:数千〜数十万人✓
✓
それなりの性能が必要
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
性能向上方法
CPU
マルチプロセス1択✓
✓
通信・多同時接続
いろいろ✓
✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
マルチプロセス
マスタープロセス
listen()a.
fork()b.
✓
ワーカープロセス
accept()a.
↑したクライアントの処理b.
✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Ruby組み込みとfork()
fork()すると
ワーカープロセスがクラッシュ
プロセス終了時とか✓
✓
ヒント:fork()とスレッド✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
fork()とスレッド
混ぜるな危険✓
Rubyはスレッドを動かしている
例:タイマースレッド✓
✓
fork時にスレッドのケアが必要✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
スレッドのケア
VALUE rb_pid;
/* タイマースレッドの後始末とか
した上でfork */
rb_pid = rb_funcall(rb_mKernel,
rb_intern("fork"),
0);
return NUM2INT(rb_pid);
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Ruby組み込みの実装
初期化✓
fork対応✓
イベントループとシグナル✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
イベントループとシグナル
気にしなくてよい
アプリがシグナルを処理するから✓
✓
拡張ライブラリーなら対応必要
イベントループ中にシグナル発生✓
→すぐにイベントループを抜ける✓
✓
milter managerへのRubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Rubyの組み込みのまとめ
Rubyを組み込む実装方法を紹介✓
動的組み込みは諦めろ✓
fork時はRubyのforkを使う✓
Rubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
mrubyの組み込み
実例
Groonga
Since 2013
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
Groongaとmruby
Groonga
全文検索エンジン(mruby組み込み)✓
高速に検索結果を返し続けたい✓
リソース消費は波がない方がよい
例:いらなくなったメモリーはすぐに解放
✓
✓
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
リソース消費
時間
メモリー使用量
こっちが望ましい
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
メモリー管理
Groonga
必要なときに確保✓
いらなくなったら解放✓
✓
mruby
GC✓
メモリーが足りなくなったら解放✓
✓
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
GroongaとmrubyのGC
mrubyのGCにGroongaのリソース
管理を任せない
リソース管理:
mrubyのオブジェクトのsweep時に
Groongaのリソースを解放
✓
✓
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
mrubyのGCとリソース
mrubyのGC
Groongaリソースのサイズを知らない✓
適切なタイミングでsweepできない✓
RubyのGCも同じ✓
✓
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
実例1: 明示的な解放
# 検索
result = table.search(condition)
begin
output_result(result) # 出力
ensure
result.close # 明示的な解放
end
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
実例2: 所有権を渡さない
/* Groonga側でリソース確保 */
expr = grn_expr_create(/* ... */);
/* mrubyのオブジェクトとしてラップ */
mrb_expr = grn_mrb_value_from_grn_obj(mrb, expr);
/* mruby側は参照して処理する */
mrb_size = mrb_funcall(mrb, mrb_expr,
"estimate_size", 1, mrb_table);
/* Groonga側でリソース解放 */
grn_expr_close(expr);
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
mruby組み込みのまとめ
GCに任せないという選択
使用メモリー量を安定させるため✓
安定した性能を出すため✓
✓
mrubyの組み込み
Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9
まとめ
Rubyの組み込み
ガッツリ連携するつもりで設計
拡張ライブラリーで十分じゃないかよく検討すること
✓
✓
mrubyの組み込み
アプリの大事な事を忘れないで設計✓
✓
OSS Gateもよろしく✓

More Related Content

What's hot

Spring I/O 2016 報告 Test / Cloud / Other Popular Sessions
Spring I/O 2016 報告 Test / Cloud / Other Popular SessionsSpring I/O 2016 報告 Test / Cloud / Other Popular Sessions
Spring I/O 2016 報告 Test / Cloud / Other Popular SessionsTakuya Iwatsuka
 
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3techConsumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3techToshiaki Maki
 
Jenkins X on GKE & Rancher2.0 on ORACLE Cloud
Jenkins X on GKE & Rancher2.0 on ORACLE CloudJenkins X on GKE & Rancher2.0 on ORACLE Cloud
Jenkins X on GKE & Rancher2.0 on ORACLE Cloudcyberblack28 Ichikawa
 
20190604 Containerized MagicOnion on kubernetes with Observability with New R...
20190604 Containerized MagicOnion on kubernetes with Observability with New R...20190604 Containerized MagicOnion on kubernetes with Observability with New R...
20190604 Containerized MagicOnion on kubernetes with Observability with New R...Takayoshi Tanaka
 
Responsableを使ったadr実装
Responsableを使ったadr実装Responsableを使ったadr実装
Responsableを使ったadr実装Kenjiro Kubota
 
祝 top-level project Apache Geode
祝 top-level project Apache Geode祝 top-level project Apache Geode
祝 top-level project Apache GeodeTomohiro Ichimura
 
5分でわかる Capabilities と Privilege + KubeCon Recap
5分でわかる Capabilities と Privilege + KubeCon Recap5分でわかる Capabilities と Privilege + KubeCon Recap
5分でわかる Capabilities と Privilege + KubeCon RecapMasaya Aoyama
 
コードの自動修正によって実現する、機能開発を止めないフレームワーク移行
コードの自動修正によって実現する、機能開発を止めないフレームワーク移行コードの自動修正によって実現する、機能開発を止めないフレームワーク移行
コードの自動修正によって実現する、機能開発を止めないフレームワーク移行gree_tech
 
Deno を aws fargate で動かす
Deno を aws fargate で動かすDeno を aws fargate で動かす
Deno を aws fargate で動かす虎の穴 開発室
 
Spring native について
Spring native についてSpring native について
Spring native についてTakamasa Mitsuji
 
Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3
Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3
Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3Toshiaki Maki
 
SpringOne 2016 報告 Reactive APIの設計・実装・使用
SpringOne 2016 報告 Reactive APIの設計・実装・使用SpringOne 2016 報告 Reactive APIの設計・実装・使用
SpringOne 2016 報告 Reactive APIの設計・実装・使用Takuya Iwatsuka
 
Kubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tk
Kubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tkKubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tk
Kubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tkwhywaita
 
LaravelでAPI定義を管理する
LaravelでAPI定義を管理するLaravelでAPI定義を管理する
LaravelでAPI定義を管理するKenjiro Kubota
 

What's hot (20)

Spring I/O 2016 報告 Test / Cloud / Other Popular Sessions
Spring I/O 2016 報告 Test / Cloud / Other Popular SessionsSpring I/O 2016 報告 Test / Cloud / Other Popular Sessions
Spring I/O 2016 報告 Test / Cloud / Other Popular Sessions
 
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3techConsumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
Consumer Driven Contractsで REST API/マイクロサービスをテスト #m3tech
 
Scala on gae
Scala on gaeScala on gae
Scala on gae
 
Spring social の基礎
Spring social の基礎Spring social の基礎
Spring social の基礎
 
GraphQL with React
GraphQL with ReactGraphQL with React
GraphQL with React
 
Jenkins X on GKE & Rancher2.0 on ORACLE Cloud
Jenkins X on GKE & Rancher2.0 on ORACLE CloudJenkins X on GKE & Rancher2.0 on ORACLE Cloud
Jenkins X on GKE & Rancher2.0 on ORACLE Cloud
 
Scalaでもgae
ScalaでもgaeScalaでもgae
Scalaでもgae
 
Wagby on Cloud Foundry
Wagby on Cloud FoundryWagby on Cloud Foundry
Wagby on Cloud Foundry
 
20190604 Containerized MagicOnion on kubernetes with Observability with New R...
20190604 Containerized MagicOnion on kubernetes with Observability with New R...20190604 Containerized MagicOnion on kubernetes with Observability with New R...
20190604 Containerized MagicOnion on kubernetes with Observability with New R...
 
Responsableを使ったadr実装
Responsableを使ったadr実装Responsableを使ったadr実装
Responsableを使ったadr実装
 
祝 top-level project Apache Geode
祝 top-level project Apache Geode祝 top-level project Apache Geode
祝 top-level project Apache Geode
 
5分でわかる Capabilities と Privilege + KubeCon Recap
5分でわかる Capabilities と Privilege + KubeCon Recap5分でわかる Capabilities と Privilege + KubeCon Recap
5分でわかる Capabilities と Privilege + KubeCon Recap
 
コードの自動修正によって実現する、機能開発を止めないフレームワーク移行
コードの自動修正によって実現する、機能開発を止めないフレームワーク移行コードの自動修正によって実現する、機能開発を止めないフレームワーク移行
コードの自動修正によって実現する、機能開発を止めないフレームワーク移行
 
Deno を aws fargate で動かす
Deno を aws fargate で動かすDeno を aws fargate で動かす
Deno を aws fargate で動かす
 
Spring native について
Spring native についてSpring native について
Spring native について
 
Spring I/O 2015 報告
Spring I/O 2015 報告Spring I/O 2015 報告
Spring I/O 2015 報告
 
Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3
Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3
Reactive Webアプリケーション - そしてSpring 5へ #jjug_ccc #ccc_ef3
 
SpringOne 2016 報告 Reactive APIの設計・実装・使用
SpringOne 2016 報告 Reactive APIの設計・実装・使用SpringOne 2016 報告 Reactive APIの設計・実装・使用
SpringOne 2016 報告 Reactive APIの設計・実装・使用
 
Kubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tk
Kubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tkKubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tk
Kubernetesの良さを活かして開発・運用!Cloud Native入門 / An introductory Cloud Native #osc19tk
 
LaravelでAPI定義を管理する
LaravelでAPI定義を管理するLaravelでAPI定義を管理する
LaravelでAPI定義を管理する
 

Viewers also liked

Visita de estudo ao pavilhão do conhecimento 24 nov_2015
Visita de estudo ao pavilhão do conhecimento  24 nov_2015Visita de estudo ao pavilhão do conhecimento  24 nov_2015
Visita de estudo ao pavilhão do conhecimento 24 nov_2015anabelaac
 
Mercadotecnia electronica.html
Mercadotecnia electronica.htmlMercadotecnia electronica.html
Mercadotecnia electronica.htmlMIGUEL ALVAREZ
 
marketing_cloud_fundamentals
marketing_cloud_fundamentalsmarketing_cloud_fundamentals
marketing_cloud_fundamentalsPetr Cikan
 
Information about the SSL Certificate
Information about the SSL CertificateInformation about the SSL Certificate
Information about the SSL CertificateCheapSSLUSA
 
Adam at Comunicaciones Hoy
Adam at Comunicaciones HoyAdam at Comunicaciones Hoy
Adam at Comunicaciones HoyAdam Datacenter
 
Introducing mroonga 20111129
Introducing mroonga 20111129Introducing mroonga 20111129
Introducing mroonga 20111129Kentoku
 
Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Kentoku
 
初心者向けMroonga・PGroonga情報
初心者向けMroonga・PGroonga情報初心者向けMroonga・PGroonga情報
初心者向けMroonga・PGroonga情報Kouhei Sutou
 
Mroonga最新情報2016
Mroonga最新情報2016Mroonga最新情報2016
Mroonga最新情報2016Kouhei Sutou
 
Apache ArrowのRubyバインディングをGObject Introspectionで
Apache ArrowのRubyバインディングをGObject IntrospectionでApache ArrowのRubyバインディングをGObject Introspectionで
Apache ArrowのRubyバインディングをGObject IntrospectionでKouhei Sutou
 
Photography Introduction
Photography IntroductionPhotography Introduction
Photography Introductionjackoregan1996
 
PGroonga – Make PostgreSQL fast full text search platform for all languages!
PGroonga – Make PostgreSQL fast full text search platform for all languages!PGroonga – Make PostgreSQL fast full text search platform for all languages!
PGroonga – Make PostgreSQL fast full text search platform for all languages!Kouhei Sutou
 
MySQL 5.7 InnoDB 日本語全文検索(その2)
MySQL 5.7 InnoDB 日本語全文検索(その2)MySQL 5.7 InnoDB 日本語全文検索(その2)
MySQL 5.7 InnoDB 日本語全文検索(その2)yoyamasaki
 
I need a flourishing business model v2.0 (comments remove, pk original text)(1)
I need a flourishing business model v2.0 (comments remove, pk original text)(1)I need a flourishing business model v2.0 (comments remove, pk original text)(1)
I need a flourishing business model v2.0 (comments remove, pk original text)(1)Patricia Kambitsch
 

Viewers also liked (20)

Seller survay0001
Seller survay0001Seller survay0001
Seller survay0001
 
Certificate_2
Certificate_2Certificate_2
Certificate_2
 
Visita de estudo ao pavilhão do conhecimento 24 nov_2015
Visita de estudo ao pavilhão do conhecimento  24 nov_2015Visita de estudo ao pavilhão do conhecimento  24 nov_2015
Visita de estudo ao pavilhão do conhecimento 24 nov_2015
 
Mercadotecnia electronica.html
Mercadotecnia electronica.htmlMercadotecnia electronica.html
Mercadotecnia electronica.html
 
marketing_cloud_fundamentals
marketing_cloud_fundamentalsmarketing_cloud_fundamentals
marketing_cloud_fundamentals
 
Certificate_6
Certificate_6Certificate_6
Certificate_6
 
Information about the SSL Certificate
Information about the SSL CertificateInformation about the SSL Certificate
Information about the SSL Certificate
 
Groonga族2016
Groonga族2016Groonga族2016
Groonga族2016
 
Adam at Comunicaciones Hoy
Adam at Comunicaciones HoyAdam at Comunicaciones Hoy
Adam at Comunicaciones Hoy
 
textsearch groonga v0.1
textsearch groonga v0.1textsearch groonga v0.1
textsearch groonga v0.1
 
Introducing mroonga 20111129
Introducing mroonga 20111129Introducing mroonga 20111129
Introducing mroonga 20111129
 
Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129Mroonga unsupported feature_20111129
Mroonga unsupported feature_20111129
 
EFFICIENT TRUSTED CLOUD STORAGE USING PARALLEL CLOUD COMPUTING
EFFICIENT TRUSTED CLOUD STORAGE USING PARALLEL CLOUD COMPUTINGEFFICIENT TRUSTED CLOUD STORAGE USING PARALLEL CLOUD COMPUTING
EFFICIENT TRUSTED CLOUD STORAGE USING PARALLEL CLOUD COMPUTING
 
初心者向けMroonga・PGroonga情報
初心者向けMroonga・PGroonga情報初心者向けMroonga・PGroonga情報
初心者向けMroonga・PGroonga情報
 
Mroonga最新情報2016
Mroonga最新情報2016Mroonga最新情報2016
Mroonga最新情報2016
 
Apache ArrowのRubyバインディングをGObject Introspectionで
Apache ArrowのRubyバインディングをGObject IntrospectionでApache ArrowのRubyバインディングをGObject Introspectionで
Apache ArrowのRubyバインディングをGObject Introspectionで
 
Photography Introduction
Photography IntroductionPhotography Introduction
Photography Introduction
 
PGroonga – Make PostgreSQL fast full text search platform for all languages!
PGroonga – Make PostgreSQL fast full text search platform for all languages!PGroonga – Make PostgreSQL fast full text search platform for all languages!
PGroonga – Make PostgreSQL fast full text search platform for all languages!
 
MySQL 5.7 InnoDB 日本語全文検索(その2)
MySQL 5.7 InnoDB 日本語全文検索(その2)MySQL 5.7 InnoDB 日本語全文検索(その2)
MySQL 5.7 InnoDB 日本語全文検索(その2)
 
I need a flourishing business model v2.0 (comments remove, pk original text)(1)
I need a flourishing business model v2.0 (comments remove, pk original text)(1)I need a flourishing business model v2.0 (comments remove, pk original text)(1)
I need a flourishing business model v2.0 (comments remove, pk original text)(1)
 

Similar to アプリケーションへのRubyインタープリターの組み込み

Rails on GKEで運用するWebアプリケーションの紹介
Rails on GKEで運用するWebアプリケーションの紹介Rails on GKEで運用するWebアプリケーションの紹介
Rails on GKEで運用するWebアプリケーションの紹介Makoto Haruyama
 
CloudSpiral 2014年度 Webアプリ講義(2日目)
CloudSpiral 2014年度 Webアプリ講義(2日目)CloudSpiral 2014年度 Webアプリ講義(2日目)
CloudSpiral 2014年度 Webアプリ講義(2日目)Shin Matsumoto
 
Ruby Enterprise Environment
Ruby Enterprise EnvironmentRuby Enterprise Environment
Ruby Enterprise EnvironmentTomoya Kawanishi
 
アメブロの大規模システム刷新とそれを支えるSpring.
アメブロの大規模システム刷新とそれを支えるSpring.アメブロの大規模システム刷新とそれを支えるSpring.
アメブロの大規模システム刷新とそれを支えるSpring.Masaki Mukai
 
分散環境におけるDocker とオーケストレーション
分散環境におけるDocker とオーケストレーション分散環境におけるDocker とオーケストレーション
分散環境におけるDocker とオーケストレーションMasahito Zembutsu
 
Sflt17 meteorではじめる最速ウェブアプリ開発
Sflt17 meteorではじめる最速ウェブアプリ開発Sflt17 meteorではじめる最速ウェブアプリ開発
Sflt17 meteorではじめる最速ウェブアプリ開発Hironao Sekine
 
VSCodeで始めるAzure Static Web Apps開発
VSCodeで始めるAzure Static Web Apps開発VSCodeで始めるAzure Static Web Apps開発
VSCodeで始めるAzure Static Web Apps開発Yuta Matsumura
 
プログラマー
プログラマープログラマー
プログラマーKouhei Sutou
 
Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能
Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能
Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能Takuya Iwatsuka
 
Server side Swift & Photo Booth
Server side Swift & Photo Booth Server side Swift & Photo Booth
Server side Swift & Photo Booth LINE Corporation
 
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -Yukihiko SAWANOBORI
 
デブサミ2013【15-D-4】Opsから挑むDevOps
デブサミ2013【15-D-4】Opsから挑むDevOpsデブサミ2013【15-D-4】Opsから挑むDevOps
デブサミ2013【15-D-4】Opsから挑むDevOpsDevelopers Summit
 
はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入Yu Nobuoka
 
サーバーレスで ガチ本番運用までやってるお話し
サーバーレスで ガチ本番運用までやってるお話しサーバーレスで ガチ本番運用までやってるお話し
サーバーレスで ガチ本番運用までやってるお話しAkira Nagata
 
Rails composerでrails newを楽にしよう
Rails composerでrails newを楽にしようRails composerでrails newを楽にしよう
Rails composerでrails newを楽にしよう健太 田上
 
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
2021/03/19 パブリッククラウドを活かす運用プロセス自動化2021/03/19 パブリッククラウドを活かす運用プロセス自動化
2021/03/19 パブリッククラウドを活かす運用プロセス自動化Issei Hiraoka
 
Tokyo ruby kaigi 10 (sogabe)
Tokyo ruby kaigi 10 (sogabe)Tokyo ruby kaigi 10 (sogabe)
Tokyo ruby kaigi 10 (sogabe)Takashi Sogabe
 
ゲームのインフラをAwsで実戦tips全て見せます
ゲームのインフラをAwsで実戦tips全て見せますゲームのインフラをAwsで実戦tips全て見せます
ゲームのインフラをAwsで実戦tips全て見せますinfinite_loop
 

Similar to アプリケーションへのRubyインタープリターの組み込み (20)

Rails on GKEで運用するWebアプリケーションの紹介
Rails on GKEで運用するWebアプリケーションの紹介Rails on GKEで運用するWebアプリケーションの紹介
Rails on GKEで運用するWebアプリケーションの紹介
 
CloudSpiral 2014年度 Webアプリ講義(2日目)
CloudSpiral 2014年度 Webアプリ講義(2日目)CloudSpiral 2014年度 Webアプリ講義(2日目)
CloudSpiral 2014年度 Webアプリ講義(2日目)
 
Ruby Enterprise Environment
Ruby Enterprise EnvironmentRuby Enterprise Environment
Ruby Enterprise Environment
 
アメブロの大規模システム刷新とそれを支えるSpring.
アメブロの大規模システム刷新とそれを支えるSpring.アメブロの大規模システム刷新とそれを支えるSpring.
アメブロの大規模システム刷新とそれを支えるSpring.
 
分散環境におけるDocker とオーケストレーション
分散環境におけるDocker とオーケストレーション分散環境におけるDocker とオーケストレーション
分散環境におけるDocker とオーケストレーション
 
Sflt17 meteorではじめる最速ウェブアプリ開発
Sflt17 meteorではじめる最速ウェブアプリ開発Sflt17 meteorではじめる最速ウェブアプリ開発
Sflt17 meteorではじめる最速ウェブアプリ開発
 
VSCodeで始めるAzure Static Web Apps開発
VSCodeで始めるAzure Static Web Apps開発VSCodeで始めるAzure Static Web Apps開発
VSCodeで始めるAzure Static Web Apps開発
 
プログラマー
プログラマープログラマー
プログラマー
 
Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能
Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能
Spring I/O 2019 報告 Spring Frameworkのロードマップと5.2の新機能
 
Server side Swift & Photo Booth
Server side Swift & Photo Booth Server side Swift & Photo Booth
Server side Swift & Photo Booth
 
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
 
デブサミ2013【15-D-4】Opsから挑むDevOps
デブサミ2013【15-D-4】Opsから挑むDevOpsデブサミ2013【15-D-4】Opsから挑むDevOps
デブサミ2013【15-D-4】Opsから挑むDevOps
 
はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入はてなにおける継続的デプロイメントの現状と Docker の導入
はてなにおける継続的デプロイメントの現状と Docker の導入
 
サーバーレスで ガチ本番運用までやってるお話し
サーバーレスで ガチ本番運用までやってるお話しサーバーレスで ガチ本番運用までやってるお話し
サーバーレスで ガチ本番運用までやってるお話し
 
Ruby開発者のためのHeroku入門
Ruby開発者のためのHeroku入門Ruby開発者のためのHeroku入門
Ruby開発者のためのHeroku入門
 
Rails composerでrails newを楽にしよう
Rails composerでrails newを楽にしようRails composerでrails newを楽にしよう
Rails composerでrails newを楽にしよう
 
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
2021/03/19 パブリッククラウドを活かす運用プロセス自動化2021/03/19 パブリッククラウドを活かす運用プロセス自動化
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
 
ドリコムJenkins勉強会資料
ドリコムJenkins勉強会資料ドリコムJenkins勉強会資料
ドリコムJenkins勉強会資料
 
Tokyo ruby kaigi 10 (sogabe)
Tokyo ruby kaigi 10 (sogabe)Tokyo ruby kaigi 10 (sogabe)
Tokyo ruby kaigi 10 (sogabe)
 
ゲームのインフラをAwsで実戦tips全て見せます
ゲームのインフラをAwsで実戦tips全て見せますゲームのインフラをAwsで実戦tips全て見せます
ゲームのインフラをAwsで実戦tips全て見せます
 

More from Kouhei Sutou

RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowRubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowKouhei Sutou
 
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Kouhei Sutou
 
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowRubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowKouhei Sutou
 
Rubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアRubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアKouhei Sutou
 
Apache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかApache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかKouhei Sutou
 
Apache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataApache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataKouhei Sutou
 
Redmine検索の未来像
Redmine検索の未来像Redmine検索の未来像
Redmine検索の未来像Kouhei Sutou
 
Apache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataApache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataKouhei Sutou
 
Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Kouhei Sutou
 
Apache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームApache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームKouhei Sutou
 
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムMySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムKouhei Sutou
 
MySQL 8.0でMroonga
MySQL 8.0でMroongaMySQL 8.0でMroonga
MySQL 8.0でMroongaKouhei Sutou
 
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Kouhei Sutou
 
MariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムMariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムKouhei Sutou
 
PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!Kouhei Sutou
 

More from Kouhei Sutou (20)

RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowRubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
 
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
 
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowRubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
 
Rubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアRubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェア
 
Apache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかApache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのか
 
Apache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataApache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory data
 
Apache Arrow 2019
Apache Arrow 2019Apache Arrow 2019
Apache Arrow 2019
 
Redmine検索の未来像
Redmine検索の未来像Redmine検索の未来像
Redmine検索の未来像
 
Apache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataApache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory data
 
Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6
 
Apache Arrow
Apache ArrowApache Arrow
Apache Arrow
 
Apache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームApache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォーム
 
Apache Arrow
Apache ArrowApache Arrow
Apache Arrow
 
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムMySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
 
MySQL 8.0でMroonga
MySQL 8.0でMroongaMySQL 8.0でMroonga
MySQL 8.0でMroonga
 
My way with Ruby
My way with RubyMy way with Ruby
My way with Ruby
 
Red Data Tools
Red Data ToolsRed Data Tools
Red Data Tools
 
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
 
MariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムMariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システム
 
PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!
 

アプリケーションへのRubyインタープリターの組み込み

  • 1. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Embed Ruby アプリケーションへの Rubyインタープリターの組み込み 須藤功平 株式会社クリアコード 東京Ruby会議11 2016-05-28
  • 2. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Speaker's award Continuous development award
  • 3. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 受賞者 cedlemo Continuous development award
  • 4. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 受賞理由 2015年1月から継続的に Ruby-GNOME2の開発に 参加しているから 一発すごい改善をした人よりも 地味でも継続的に改善している人を評価したい Continuous development award cedlemo
  • 5. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 宣伝 OSS Gate
  • 6. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 OSS Gate OSS開発に 参加する人を 増やす取り組み
  • 7. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 背景 OSS利用は当たり前になった →OSS利用者増加✓ ✓ 開発参加者も増えるといいな →OSS増加✓ ✓ OSS Gate
  • 8. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 OSS開発参加 すごい改善じゃなくていい✓ バグレポートとかでいい typo見つけました!とかでもいい✓ サンプルを更新とかでもいい✓ ✓ OSS Gate
  • 9. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 OSS Gate参加の動機 人それぞれでいい OSS Gate
  • 10. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 私の動機 ユーザーが自由に使える ソフトウェアが増えるといいな ✓ 自由に使える例: コードを読んで学習できる✓ 今日聞いた話の実装を確認できる!✓ ✓ OSS Gate
  • 11. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 興味ある? 興味?(重要:動機不問) OSS開発に参加したい!✓ OSS開発参加者を増やしたい!✓ ✓ 5階でワークショップ開催中 説明や見学は私に一声かけて✓ ✓ OSS Gate
  • 12. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 本題 Rubyの組み込み (CアプリケーションへのRubyインタープリターの組み込み)
  • 13. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 動機 柔軟な記述力が欲しい✓ Cの速さが欲しい✓ Ruby以外の言語とも連携したい Pythonも組み込む✓ ✓ なんかカッコいい✓ Rubyの組み込み
  • 14. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 別の実現方法 拡張ライブラリー Rubyの組み込み
  • 15. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 組み込みと拡張ライブラリー C Ruby Ruby C Ruby組み込み 拡張 ライブラリー Rubyの組み込み
  • 16. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 拡張ライブラリー 実現可能: 柔軟な記述力が欲しい✓ Cの速さが欲しい✓ ✓ 実現不可能: Ruby以外の言語とも連携したい✓ なんかカッコいい感✓ ✓ Rubyの組み込み
  • 17. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 実現方法の選び方 基本は拡張ライブラリー✓ すでにあるアプリなら組み込み✓ 選びたい方があるならそっち✓ Rubyの組み込み
  • 18. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 組み込みを選ぶ時の注意 それなりの覚悟が必要 利用例があまりない 問題遭遇確率が高い✓ ✓ 問題遭遇時: 自分でソースを読んで調べる✓ 詳しい人に相談 ささださん<できればサポートを強化したい ✓ ✓ Rubyの組み込み
  • 19. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 組み込み方を紹介 実例 milter manager Since 2008
  • 20. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 milter manager メール サーバー milter manager メール フィルター メール フィルター メール フィルターmilter Ruby milterを管理するmilter サーバープロセス
  • 21. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Ruby組み込みの実装 初期化✓ fork対応✓ イベントループとシグナル✓ milter managerへのRubyの組み込み
  • 22. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 初期化:GC関連 { /* スタックの底を設定 */ /* GC時にCのローカル変数に代入されている Rubyのオブジェクトをマークするため */ RUBY_INIT_STACK; /* ... */ } milter managerへのRubyの組み込み
  • 23. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 スタックとマーク対象 { RUBY_INIT_STACK; /* ... */ { VALUE object = rb_ary_new(); /* マーク対象 */ } } { VALUE object = rb_ary_new(); /* マーク対象外 */ } milter managerへのRubyの組み込み
  • 24. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 確認例 #define MARKED_P(object) rb_objspace_marked_object_p(object) { RUBY_INIT_STACK; { VALUE object = rb_ary_new(); /* GC.start(immediate_sweep: false) */ printf("%dn", MARKED_P(object)); /* => 1 */ } } { VALUE object = rb_ary_new(); /* GC.start(immediate_sweep: false) */ printf("%dn", MARKED_P(object)); /* => 0 */ } スライドのリポジトリー:examples/gc.c
  • 25. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 GC関連の注意 { RUBY_INIT_STACK; /* Rubyのオブジェクトを触る Cのコードはこのブロック内でだけ使うこと */ /* Cからのコールバックで Rubyのコードを呼び出すときは注意 */ } milter managerへのRubyの組み込み
  • 26. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 初期化:シグナル関連 { RUBY_INIT_STACK; /* シグナルハンドラーを保存 */ ruby_init(); /* Rubyがシグナルハンドラーを登録 */ /* シグナルハンドラーを復帰 */ /* シグナルはアプリで処理したいから */ } milter managerへのRubyの組み込み
  • 27. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 シグナル復帰例 { /* 他のシグナルも同様に復帰 */ void (*sigint_handler)(int); sigint_handler = signal(SIGINT, SIG_DFL); ruby_init(); signal(SIGINT, sigint_handler); } milter managerへのRubyの組み込み
  • 28. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 初期化:引数の処理 { /* ...ruby_init()... */ static char *argv_raw[] = {"milter-manager", "-e;"}; int argc; char **argv; argc = sizeof(argv_raw) / sizeof(char *); argv = argv_raw; ruby_incpush(/* ... */); /* $LOAD_PATHの設定 */ /* 中でいろいろ初期化するのでダミーの引数で呼ぶ */ ruby_process_options(argc, argv); } milter managerへのRubyの組み込み
  • 29. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 初期化:アプリの初期化 { /* ...ruby_process_options()... */ /* require中に例外が発生してもここで止める */ /* ここで止めないと例外を受け取る人がいなくて クラッシュ */ rb_protect(/* rb_require("milter/manager") */); } milter managerへのRubyの組み込み
  • 30. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 milter managerとRuby 組み込み処理系の1つ Pythonも使えるようにしたかった 結局Ruby必須でPython対応はしなかった ✓ ✓ 起動後にdlopen()で動的にsoを 読み込んで組み込み ✓ milter managerへのRubyの組み込み
  • 31. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 起動時に動的に組み込み milter manager Ruby milter manager Ruby 起動前 起動 起動後 milter manager Ruby dlopen() milter managerへのRubyの組み込み
  • 32. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 起動時にso読んで組み込み { /* ↓GC用 */ RUBY_INIT_STACK; /* 動的にsoを読んで初期化関数を呼ぶ */ /* dlopen(); init = dlsym(); init(); ←の中でruby_init();とか */ /* アプリの処理 */ } milter managerへのRubyの組み込み
  • 33. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 RUBY_INIT_STACK!? { /* ↓アプリ側で呼ぶの!? */ RUBY_INIT_STACK; /* 動的にsoを読んで初期化関数を呼ぶ */ /* dlopen(); init = dlsym(); init(); ←の中でruby_init();とか */ /* アプリの処理 */ } milter managerへのRubyの組み込み
  • 34. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 アプリにーlruby… milter manager Ruby milter manager Ruby 起動前 起動 起動後 milter manager Ruby dlopen() -lruby カッコわるい。。。 milter managerへのRubyの組み込み
  • 35. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Ruby組み込み時の意気込み 本体に組み込む✓ 動的に組み込もうとしない✓
  • 36. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Ruby組み込みの実装 初期化✓ fork対応✓ イベントループとシグナル✓ milter managerへのRubyの組み込み
  • 37. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 milter manager利用例 大学・企業 ユーザー数:数百〜数万人✓ ✓ プロバイダー ユーザー数:数千〜数十万人✓ ✓ それなりの性能が必要 milter managerへのRubyの組み込み
  • 38. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 性能向上方法 CPU マルチプロセス1択✓ ✓ 通信・多同時接続 いろいろ✓ ✓ milter managerへのRubyの組み込み
  • 39. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 マルチプロセス マスタープロセス listen()a. fork()b. ✓ ワーカープロセス accept()a. ↑したクライアントの処理b. ✓ milter managerへのRubyの組み込み
  • 40. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Ruby組み込みとfork() fork()すると ワーカープロセスがクラッシュ プロセス終了時とか✓ ✓ ヒント:fork()とスレッド✓ milter managerへのRubyの組み込み
  • 41. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 fork()とスレッド 混ぜるな危険✓ Rubyはスレッドを動かしている 例:タイマースレッド✓ ✓ fork時にスレッドのケアが必要✓ milter managerへのRubyの組み込み
  • 42. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 スレッドのケア VALUE rb_pid; /* タイマースレッドの後始末とか した上でfork */ rb_pid = rb_funcall(rb_mKernel, rb_intern("fork"), 0); return NUM2INT(rb_pid); milter managerへのRubyの組み込み
  • 43. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Ruby組み込みの実装 初期化✓ fork対応✓ イベントループとシグナル✓ milter managerへのRubyの組み込み
  • 44. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 イベントループとシグナル 気にしなくてよい アプリがシグナルを処理するから✓ ✓ 拡張ライブラリーなら対応必要 イベントループ中にシグナル発生✓ →すぐにイベントループを抜ける✓ ✓ milter managerへのRubyの組み込み
  • 45. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Rubyの組み込みのまとめ Rubyを組み込む実装方法を紹介✓ 動的組み込みは諦めろ✓ fork時はRubyのforkを使う✓ Rubyの組み込み
  • 46. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 mrubyの組み込み 実例 Groonga Since 2013
  • 47. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 Groongaとmruby Groonga 全文検索エンジン(mruby組み込み)✓ 高速に検索結果を返し続けたい✓ リソース消費は波がない方がよい 例:いらなくなったメモリーはすぐに解放 ✓ ✓ mrubyの組み込み
  • 48. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 リソース消費 時間 メモリー使用量 こっちが望ましい mrubyの組み込み
  • 49. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 メモリー管理 Groonga 必要なときに確保✓ いらなくなったら解放✓ ✓ mruby GC✓ メモリーが足りなくなったら解放✓ ✓ mrubyの組み込み
  • 50. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 GroongaとmrubyのGC mrubyのGCにGroongaのリソース 管理を任せない リソース管理: mrubyのオブジェクトのsweep時に Groongaのリソースを解放 ✓ ✓ mrubyの組み込み
  • 51. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 mrubyのGCとリソース mrubyのGC Groongaリソースのサイズを知らない✓ 適切なタイミングでsweepできない✓ RubyのGCも同じ✓ ✓ mrubyの組み込み
  • 52. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 実例1: 明示的な解放 # 検索 result = table.search(condition) begin output_result(result) # 出力 ensure result.close # 明示的な解放 end mrubyの組み込み
  • 53. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 実例2: 所有権を渡さない /* Groonga側でリソース確保 */ expr = grn_expr_create(/* ... */); /* mrubyのオブジェクトとしてラップ */ mrb_expr = grn_mrb_value_from_grn_obj(mrb, expr); /* mruby側は参照して処理する */ mrb_size = mrb_funcall(mrb, mrb_expr, "estimate_size", 1, mrb_table); /* Groonga側でリソース解放 */ grn_expr_close(expr); mrubyの組み込み
  • 54. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 mruby組み込みのまとめ GCに任せないという選択 使用メモリー量を安定させるため✓ 安定した性能を出すため✓ ✓ mrubyの組み込み
  • 55. Embed Ruby - アプリケーションへのRubyインタープリターの組み込み Powered by Rabbit 2.1.9 まとめ Rubyの組み込み ガッツリ連携するつもりで設計 拡張ライブラリーで十分じゃないかよく検討すること ✓ ✓ mrubyの組み込み アプリの大事な事を忘れないで設計✓ ✓ OSS Gateもよろしく✓