Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

ROMA on JRuby at JRubyKaigi 2010

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
Cakephp勉強会@tokyo #4
Cakephp勉強会@tokyo #4
Wird geladen in …3
×

Hier ansehen

1 von 9 Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Andere mochten auch (20)

Anzeige

Ähnlich wie ROMA on JRuby at JRubyKaigi 2010 (20)

Weitere von Rakuten Group, Inc. (20)

Anzeige

Aktuellste (20)

ROMA on JRuby at JRubyKaigi 2010

  1. 1. ROMA on JRuby Rakuten, Inc., Rakuten Institute of Technology, Tokyo | Muga Nishizawa | Aug. 28, 2010
  2. 2. Multi-Ruby Platform Support <ul><li>Working to run ROMA on various Ruby platforms 様々な Ruby 実装に ROMA を対応させていく </li></ul><ul><ul><li>Trying to achieve both high performance and usability より高いパフォーマンスと使い易さを目指す </li></ul></ul><ul><li>ROMA is one of distributed hash tables (key-value stores) in Ruby ROMA とは、分散ハッシュテーブル( Key-Value Store ) </li></ul><ul><ul><li>Originally developed at Rakuten, Inc. It was opensourced in Nov. 2009 楽天(株)で開発され、 2009 年 11 月に OSS 化 </li></ul></ul><ul><ul><ul><li>http://github.com/roma/roma.git </li></ul></ul></ul><ul><ul><li>Pure P2P architecture, in particular, consistent hashing Pure P2P アーキテクチャを基にしている </li></ul></ul>End-sers Request Response ROMA Web Server Put Key-Value like session data Get the value
  3. 3. Trying ROMA on JRuby <ul><li>Tried to run ROMA on JRuby 1.4 and 1.5 JRuby 1.4, 1.5 で ROMA を動かせるか試す </li></ul><ul><ul><li>Close! 惜しい! </li></ul></ul><ul><ul><li>Logger doesn’t work in 1.9 mode. It is a very important issue… Logger が動作しない </li></ul></ul><ul><ul><li>But this appears to be fixed in JRuby 1.6 しかし JRuby 1.6 で、そのバグは fix されるとのこと </li></ul></ul>[muga@f11vm server]$ jruby --1.9 bin/romad localhost -p 11311 /usr/local/rvm/rubies/jruby-1.4.0/lib/ruby/1.9/logger.rb:535:in `initialize': can't convert Fixnum into String (TypeError) from /usr/local/rvm/rubies/jruby-1.4.0/lib/ruby/1.9/logger.rb:535:in `open' from /usr/local/rvm/rubies/jruby-1.4.0/lib/ruby/1.9/logger.rb:535:in `open_logfile' from /usr/local/rvm/rubies/jruby-1.4.0/lib/ruby/1.9/logger.rb:504:in `initialize' from /usr/local/rvm/rubies/jruby-1.4.0/lib/ruby/1.9/logger.rb:280:in `new' from /usr/local/rvm/rubies/jruby-1.4.0/lib/ruby/1.9/logger.rb:280:in `initialize'
  4. 4. Thanks JRuby 1.6 <ul><li>Succeeded in running ROMA on JRuby 1.6! JRuby 1.6 上で ROMA を動かすことに成功! </li></ul><ul><ul><li>ROMA on JRuby available without writing additional source codes ROMA のソースには、 JRuby 用のコードを全く追加せず </li></ul></ul><ul><li>How to run ROMA on JRuby JRuby 上での ROMA の動かし方 </li></ul><ul><ul><li>1. Download the source code on GitHub 1. ROMA のソースを GitHub からダウンロード </li></ul></ul><ul><ul><li>2. Gem install “eventmachine” and “json-jruby” 2. Gem で eventmachine と json-jruby をインストール </li></ul></ul><ul><ul><li>3. Pre-process required, just a bit. Please see ROMA’s site. 3. 事前処理が必要( ROMA のサイトを見てください) </li></ul></ul><ul><ul><li>4. Now ROMA will run on JRuby! 4. ROMA の起動 </li></ul></ul>
  5. 5. Command Plugin in Java <ul><li>JRuby will allow implementation of new plugins in Java for ROMA Java で ROMA の plugin を実装することが可能 </li></ul><ul><ul><li>You can customize the behavior of ROMA using plugin architecture ROMA にはプラグイン機構があり、プラグインにより ROMA を拡張可能 </li></ul></ul><ul><ul><li>For example, you can extend the protocol of ROMA with your command plugins 例:プラグインで ROMA にコマンドを追加できる </li></ul></ul><ul><li>Implementing ROMA plugins in Java is cool! ROMA のプラグイン実装を Java で書けるのは良いこと </li></ul><ul><ul><li>JRuby is good platform that combines the good properties of Ruby and Java JRuby は、 Ruby と Java のより良いところを兼ね備えたプラットフォーム </li></ul></ul>
  6. 6. Example (1/2) <ul><li>Append a new command named “reverseecho” to ROMA’s protocol “reverseecho” というコマンドを ROMA プロトコルに追加 </li></ul><ul><ul><li>It returns the reverse sequence of the original character sequence ROMA に送った文字列の逆順が戻ってくるコマンド </li></ul></ul><ul><ul><li>At first, write the implementation in Java as following まず、コマンドの内部実装を Java で以下のように記述 </li></ul></ul>package echo; public class Echo { public static String[] reverse(String[] s) { int len = s.length;   String[] out = new String[len]; for (int i = 0; i < len; ++i) out[i] = new StringBuilder(s[len–i–1]).reverse().toString(); return out; } }
  7. 7. Example (2/2) <ul><li>Declare “reverseecho” command plugin as the protocol of ROMA ROMA に “ reverseecho” コマンド・プラグインを追加 </li></ul><ul><ul><li>JRuby allows invoking the previous Java program within its plugin JRuby によって、そのプラグイン内部で先の Java プログラムを呼び出せる </li></ul></ul>module Roma::CommandPlugin::PluginEcho include ::Roma::CommandPlugin require 'java' require 'echo.jar' def ev_reverseecho(s) ret = Java::echo.Echo::reverse(s).to_ary send_data(&quot;#{ret[1..-1].to_s}&quot;) end end
  8. 8. Conclusion <ul><li>Working to run ROMA on various Ruby platforms ROMA の様々な Ruby 対応を目指す </li></ul><ul><ul><li>ROMA is one of distributed hash tables (key-value stores) in Ruby ROMA とは、分散ハッシュテーブル( Key-Value Store ) </li></ul></ul><ul><li>Succeeded in running ROMA on JRuby 1.6! JRuby 1.6 上で ROMA を動かすことに成功! </li></ul><ul><ul><li>ROMA on JRuby available without writing additional source codes ROMA のソースには、 JRuby 用のコードを全く追加せず </li></ul></ul><ul><li>JRuby will allow implementation of new plugins in Java for ROMA Java で ROMA の plugin を実装することが可能 </li></ul><ul><ul><li>JRuby is good platform that combines the good properties of Ruby and Java JRuby は、 Ruby と Java のより良いところを兼ね備えたプラットフォーム </li></ul></ul>
  9. 9. Fin <ul><li>Thanks for your kind attention!! ご清聴ありがとうございました! </li></ul>

×