dRuby

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    dRuby - Presentation Transcript

    1. dRubyによる分散・Webプログラミング入門 CSNagoya toyoshi 2009/09/06
    2. dRubyとは(1) • Rubyのオブジェクトをプロセスやネット ワークを越えて扱うための仕組み • クライアント・サーバモデルのシステムが 簡単に作れる • Ruby限定 / Pure Ruby / IDL不要 • 標準添付ライブラリである 2
    3. dRubyとは(2) • dRubyが勝手にネットワークを越えてく れる クライアント ネットワーク サーバ ObjectX ObjectX dRuby dRuby 3
    4. dRubyの活用事例 • Railsプラグイン backgrounDRb • FAX 送信制御システム(株)アンタス • はてなスクリーンショット 4
    5. デモ「メモアプリ」 • どれぐらい簡単かメモアプリでみてみる サーバのコード require 'drb/drb' class Memo def initialize @item = [] end def add(str) p str @item.push(str) end def list @item end end 5
    6. わかったこと • かんたん • プロセスの寿命を越えた永続化ができる • つまりKVS的な使い方もできる オンメモリキャッシュサーバとして druby を試してみた→失敗 http://d.hatena.ne.jp/clayfish/20090610/1244634242 6
    7. Rindaによるプロセスの協調 • Rindaとは分散処理システムLindaのタプル スペースのRubyによる実装 Tuple Space write take Tuple Tuple [“Hello”, “World”] [“Hello”, “World”] 7
    8. サンプル「階乗サーバ」 • 階乗を計算するシステムを作ってみる • タプルのフォーマットは – [“fact”,最初の数字,終わりの数字] – [“fact-answer”,最初の数字,終わりの数字,結果] タプルスペース (1)write (2)take (4)take (3)write tmp, m, n = $ts.take(['fact', Integer, Integer]) $ts.write([“fact”,1,2]) value = (m..n).inject(1) { |a,b| a*b} ans = $ts.take([“fact-answer”,1,2,nil]) $ts.write(['fact-answer', m, n, value]) 8
    9. そのほかの注意点など • 参照渡しと値渡し – Marshal.dumpできるものは値渡し。できないもの は参照渡し – 値渡しの際は、値と参照の値も渡す • GC – 別プロセスからだけ参照されているオブジェクトが ガベージコレクトの対象になる場合がある • セキュリティ – Rubyは柔軟なのですごく危ない。ACLやUNIXドメ インソケット、$SAFEなどを使おう 9
    10. まとめ • とても簡単に分散オブジェクトシステムが 作れる • 夢が広がる 10
    11. 参考文献など • dRubyによる分散・Webプログラミング – 著者 関 将俊 出版社 オーム社 11
    SlideShare Zeitgeist 2009

    + toyoshitoyoshi Nominate

    custom

    304 views, 0 favs, 1 embeds more stats

    CSNagoya勉強会でのdRuby入門の発表

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 304
      • 270 on SlideShare
      • 34 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds
    • 34 views on http://www.jamboree.jp

    more

    All embeds
    • 34 views on http://www.jamboree.jp

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories