Similar documents

Rinda, druby answering the RubyConf, RubyKaigi Masatoshi SEKI

RubyKaigi2009 COBOL

BASIC / / BA- SIC Web 1/10 1/10 / / JavaScript


Ruby演習テキスト1

untitled

Kyosuke MOROHASHI

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

listings-ext

Microsoft PowerPoint - ruby_instruction.ppt

CAS Yale Open Source software Authentication Authorization (nu-cas) Backend Database Authentication Authorization Powered by A

r1.dvi

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

Condition DAQ condition condition 2 3 XML key value

Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

Boo Boo 2 Boo 2.NET Framework SDK 2 Subversion 2 2 Java 4 NAnt 5 Boo 5 5 Boo if 11 for 11 range 12 break continue 13 pass

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

ohp1.dvi

Microsoft PowerPoint - 11RubyIntro-No02.ppt [互換モード]

Emacs Ruby..

10 (1) s 10.2 rails c Rails 7 > item = PlanItem.new => #<PlanItem id nil, name nil,...> > item.name = "" => "" > item.valid? => true valid? true false

Windows Cygwin Mac *1 Emacs Ruby ( ) 1 Cygwin Bash Cygwin Windows Cygwin Cygwin Mac 1 Mac 1.2 *2 ls *3 *1 OS Linux *2 *3 Enter ( ) 2

fiš„v3.dvi

ストラドプロシージャの呼び出し方

Copyright c 2008 Zhenjiang Hu, All Right Reserved.


Ruby 2.3 のてざわり新機能と使いどころ Kunihiko Ito ESM 富山合同勉強会

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

Sequel のすすめ 私が SQL を嫌いな理由 とみたまさひろ RubyHiroba Sequel のすすめ - 私が SQL を嫌いな理由 Powered by Rabbit 2.0.7

A B 1: Ex. MPICH-G2 C.f. NXProxy [Tanaka] 2:

Ruby Ruby ruby Ruby G: Ruby>ruby Ks sample1.rb G: Ruby> irb (interactive Ruby) G: Ruby>irb -Ks irb(main):001:0> print( ) 44=>


comp -MYPEDIA Programing- Ruby 1 attr_accessor :< 1>, :< 2> class Car def = carname end attr_accessor :name end car = Car.ne

2. 2 (LAN) Web 7 2 DBMS Java Applet 2.1 Java RDBMS Java 1 Lisp S S Common Lisp Java DBMS 2.2 DBMS RDBMS(Oracle) Java BLOB(Binary Large OBject) RDBMS R

̤Äê

parser.y 3. node.rb 4. CD-ROM

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè1²ó

"CAS を利用した Single Sign On 環境の構築"

メタコンピュータ構成方式の研究

Oracle9i JDeveloperによるWebサービスの構築

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

~~~~~~~~~~~~~~~~~~ wait Call CPU time 1, latch: library cache 7, latch: library cache lock 4, job scheduler co

Java updated

ruby novice ruby novice ruby novice.

データベース認識Webサービス

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè3²ó

PowerPoint Presentation

jssst-ocaml.mgp

プラズマ核融合学会誌4月【84-4】/講座5

1. COBOL COBOL COBOL COBOL 2

test.gby


K227 Java 2

16 NanoPlanner name PlanItem.changeset/2 > validate_required([:name]) name :name Ecto.Changeset validate_required/3 Ecto.Changeset "validate_"

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè1²ó

fp.gby

xl 1 program Othello6; 2 {$APPTYPE CONSOLE} 3 uses SysUtils; 4 5 type 6 TMasuNo = 0..99; // 7 TYouso = (Soto,Kara,Kuro,Siro); // 8 TBan = array [TMasu

StateMachine Composite Structure Sequence

ex01.dvi

Sinatra と MongoDB 今回は Sinatra で MongoDB の操作を体験してみます 進捗に合わせて ドライバから Ruby で使える便利な ORM の紹介をします

untitled

PowerPoint Presentation

11夏特集号初校.indd

第5回お試しアカウント付き並列プログラミング講習会

9iAS_DEV.PDF

bdd.gby

javascript key

e10s におけるプロセス間通信の基本 219 HACK #34 Components.manager.removeBootstrappedManifestLocati on() function shutdown(adata, areason) { const IOService =


Q&A集

WinHPC ppt

1.ppt

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

Java演習(4) -- 変数と型 --

Microsoft PowerPoint - 13Kadai.pptx

Java学習教材

Plan of Talk CAS CAS 2 CAS Single Sign On CAS CAS 2 CAS Aug. 19, 2005 NII p. 2/32

WIDE 1

CAC

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

netcdf

I. (i) Java? (A). 2Apples (B). Vitamin-C (C). Peach21 (D). Pine_Apple (ii) Java? (A). Java (B). Java (C). Java (D). JavaScript Java JavaScript Java (i

PowerPoint プレゼンテーション

ex01.dvi

120802_MPI.ppt

cpp1.dvi

Spring Framework 2.0  デファクトスタンダードDIコンテナの現在と未来

(Basic Theory of Information Processing) Fortran Fortan Fortan Fortan 1

Microsoft Word - Win-Outlook.docx

Dec , IS p. 1/60

つくって学ぶプログラミング言語 RubyによるScheme処理系の実装

<Documents Title Here>

MPI MPI MPI.NET C# MPI Version2

untitled

Pascal Pascal Free Pascal CPad for Pascal Microsoft Windows OS Pascal

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp

,. OpenXM... :. Simplify. OX-RFC-104 (OoHG).. knoppix/math. Contributed software..

Transcription:

3360 druby Web

Who is translating it?

http://dx.doi.org/10.1007/s10766-008-0086-1

$32.00 International Journal of PARALLEL PROGRAMING Must buy!

http://dx.doi.org/10.1007/s10766-008-0086-1

toruby

The Good: The Bad: DRb Stupid Easy Reasonably Fast Kinda Flaky Zero Redundancy Tightly Coupled

Remote Method Invocation Remote Procedure Call

Web Service XML-RPC

shttpsrv shttpsrv UI shttpsrv user

druby RMI RMI, RPC

druby Ruby

(2) Object

(3) Object Object

def hoge(a1, a2, a3, &block)... raise FooError unless some_cond... return value end

Marshal dumpable Number, String, Boolean... can t dump Proc, Thread, File... pass by value pass by reference

irb % irb --simple-prompt --noreadline % irb --simple-prompt --noreadline

DRb.start_service >> require drb/drb >> DRb.start_service =>...

front >> require drb/drb >> front = {} >> DRb.start_service('druby://localhost:12345', front)

DRbObject >> ro = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x...> >> ro.keys => [] >> ro.class => DRb::DRbObject >> ENV.each { k, v ro[k] = v} => {...} >> ro.keys => ["MANPATH", "CVS_RSH", "USER",...]

DRbObject >> ro = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x...> >> ro.keys => [] >> ro.class => DRb::DRbObject >> ENV.each { k, v ro[k] = v} => {...} >> ro.keys => ["MANPATH", "CVS_RSH", "USER",...]

DRbObject >> ro = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x...> >> ro.keys => [] >> ro.class => DRb::DRbObject >> ENV.each { k, v ro[k] = v} => {...} >> ro.keys => ["MANPATH", "CVS_RSH", "USER",...]

>> front.keys => ["MANPATH", "CVS_RSH", "USER",...]

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

>> front['stdout'] = $stdout => #<IO:0x130d80> >> ro['stdout'] => #<DRb::DRbObject:... @uri="druby://localhost:12345"> >> ro[ stdout ].puts( Hello, World. ) >> Hello, World.

SizedQueue server require 'thread' require 'drb/drb' queue = SizedQueue.new(10) DRb.start_service('druby://localhost:12345', queue) sleep

Producer require 'drb/drb' DRb.start_service queue = DRbObject.new_with_uri('druby://localhost:12345') 100.times do n sleep(rand) queue.push(n) end

Consumer require 'drb/drb' DRb.start_service queue = DRbObject.new_with_uri('druby://localhost:12345') 100.times do sleep(rand) puts queue.pop end

DRbObject class DRbObject def initialize(obj, uri=nil) @uri = uri DRb.uri @ref = obj.id if obj end def method_missing(msg_id, *a) succ, result = DRbConn.new(@uri).send_message(self, msg_id, *a) raise result if! succ result end attr :ref end

DRbObject URI ref

method_missing class DRbObject def initialize(obj, uri=nil) @uri = uri DRb.uri @ref = obj.id if obj end def method_missing(msg_id, *a) succ, result = DRbConn.new(@uri).send_message(self, msg_id, *a) raise result if! succ result end attr :ref end

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front end result = obj. send (msg.intern, *argv) succ = true rescue result = $! succ = false end send_reply(s, succ, result) ensure close s if s end end end

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front end result = obj. send (msg.intern, *argv) succ = true rescue result = $! succ = false end send_reply(s, succ, result) ensure close s if s end end end

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front end result = obj. send (msg.intern, *argv) succ = true rescue result = $! succ = false end send_reply(s, succ, result) ensure close s if s end end end

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front end result = obj. send (msg.intern, *argv) succ = true rescue result = $! succ = false end send_reply(s, succ, result) ensure close s if s end end end

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front end result = obj. send (msg.intern, *argv) succ = true rescue result = $! succ = false end send_reply(s, succ, result) ensure close s if s end end end

DRbServer def proc ns = @soc.accept Thread.start do begin s = ns begin ro, msg, argv = recv_request(s) if ro and ro.ref obj = ObjectSpace._id2ref(ro.ref) else obj = DRb.front end result = obj. send (msg.intern, *argv) succ = true rescue result = $! succ = false end send_reply(s, succ, result) ensure close s if s end end end

def dump(obj, soc) begin str = Marshal::dump(obj) rescue ro = DRbObject.new(obj) str = Marshal::dump(ro) end soc.write(str) if soc return str end

hatena screenshot id:secondlife @ RK06 httpd DB Queue SnapShot Engine Linux 1. take a request 2. make the snapshot 3. store to DB SnapShot Engine Windows

RWiki In-Memory Database with logging Wiki Object 25000 Wiki druby ERB

WEBrick::CGI WEBrick::CGI front

CGI require webrick/cgi require drb/drb require thread class SimpleCountCGI < WEBrick::CGI def initialize super @count = Queue.new @count.push(1) end def count value = @count.pop ensure @count.push(value + 1) end def do_get(req, res) res[ content-type ] = text/plain res.body = count.to_s end end DRb.start_service( druby://localhost:12321, SimpleCountCGI.new) sleep

cgi.start() module WEBrick class CGI... def start(env=env, stdin=$stdin, stdout=$stdout)...

4 lines CGI #!/usr/local/bin/ruby require drb/ drb DRb.start_service( druby://localhost:0 ) ro = DRbObject.new_with_uri( druby://localhost:12321 ) ro.start(env.to_hash, $stdin, $stdout)

author of Linda Reviewer#1 Must buy!

Tuple Space Engine Client Engine TupleSpace Engine Client

Tuple Array Hash Marshal Marshal druby

Tuple [:chopstick, 2] [:room_ticket] [ abc, 2, 5] [:matrix, 1.6, 3.14] [ family, is-sister, Carolyn, Elinor ]

Pattern Tuple === case equals Regexp, Range, Class nil

Pattern [/^A/, nil, nil] [:matrix, Numeric, Numeric] [ family, is-sister, Carolyn, nil] [nil, age, (0..18)]

[ seki, age, 20] >> require rinda/tuplespace >> ts = Rinda::TupleSpace.new >> ts.write([ seki, age, 20]) >> ts.write([ sougo, age, 18]) >> ts.write([ leonard, age, 18]) >> ts.read_all([nil, age, 0..19]) => [["sougo", "age", 18], ["leonard", "age", 18]] >> ts.read_all([/^s/, age, Numeric]) => [["seki", "age", 20], ["sougo", "age", 18]]

>> ts = Rinda::TupleSpace.new => #<Rinda::TupleSpace:...> >> DRb.front['ts'] = ts => #<Rinda::TupleSpace:...> >> TupleSpaceProxy druby >> it = DRbObject.new_with_uri('druby://localhost:12345? ts') => #<DRb::DRbObject:...> >> ts = Rinda::TupleSpaceProxy.new(it) => #<Rinda::TupleSpaceProxy:...> >>

>> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace :seki :age 20

>> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace >> ts.take([:seki, :age, nil]) => [:seki, :age, 20] >> :seki :age 20

>> ts.take([:seki, :age, nil]) TupleSpace

>> ts.take([:seki, :age, nil]) >> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace :seki :age 20

>> ts.take([:seki, :age, nil]) >> ts.write([:seki, :age, 20]) => #<Rinda::TupleEntry:...> >> TupleSpace => [:seki, :age, 20] >> :seki :age 20

TupleSpace >> tuple = ts.take([:count, nil])

TupleSpace >> tuple = ts.take([:count, nil]) >> ts.write([:count, 0]) => #<Rinda::TupleEntry:...> >> :count 0

TupleSpace >> tuple = ts.take([:count, nil]) >> ts.write([:count, 0]) => #<Rinda::TupleEntry:...> >> => [:count, 0] >> :count 0

TupleSpace >> tuple = ts.take([:count, nil]) >> ts.write([:count, 0]) => #<Rinda::TupleEntry:...> >> => [:count, 0] >> >> tuple = ts.take([:count, nil]) >> tuple[1] += 1 => 1 >> ts.write(tuple) => #<DRb::DRbObject:...> >> => [:count, 1] >> :count 1

Application of Rinda Sapporo

Buzztter!

Buzztter!

Buzztter!

id:darashi

id:darashi

3360 druby Web

Who is translating it?

$32.00 International Journal of PARALLEL PROGRAMING Must buy!

http://dx.doi.org/10.1007/s10766-008-0086-1

Must buy! druby Buzztter.