LANWAN (2) 2011/5/25 " NAIST " " "
A A C network B C network B
" " " " (Intranet)" n " VPN (Virtual Private Network)" n "
Request-response protocol" Remote procedure call" Broadcast/multicast messaging" Message passing interface" File sharing" Tuple space" Message-oriented middleware" " Request-response protocol" Remote procedure call" " "
Request-response protocol" Send() Recv() client" Hello server Hello client server" Recv() Send() Send() Recv() Get info Here is info Recv() Send() HTTP" Hypertext transfer protocol (RFC 2616)" Request-response protocol example: HTTP HTTP client" GET / HTTP/1.1" HTTP server" HTTP/1.1 200 OK" Date: Wed, 02 Jun 2010 04:57:17 GMT" Server: Apache-Coyote/1.1" Content-Type: text/html;charset=utf-8" Set-Cookie: JSESSIONID=5619B57CC; Path=/" " GET /leaderboard.html HTTP/1.1" Host: www.theserverside.com" Cookie: JSESSIONID=5619B57CC" " HTTP/1.1 200 OK "
Async request-response protocol" " AJAX: Asynchronous JavaScript + XML" HTTP client" HTTP server" $.getjson("test.js", function(json) { alert("json Data: + json.users[3].from); }); JavaScript + jquery GET /test.js HTTP/1.1" HTTP/1.1 200 OK" Content-type: application/json" " {" from : hamachi, body : }" Remote procedure call (RPC)" SunRPC" SOAP, XML-RPC" caller" callee" a = f()" f()" " a = 1 Call f()" f() returned 1" f()" = 1 b = g()" g()" " b = 0 Call g()" g() returned 0" g()" = 0
Remote procedure call: SunRPC Interface definition program MESSAGEPROG { version PRINTMESSAGEVERS { int PRINTMESSAGE(string) = 1; } = 1; } = 0x20000001; rpcgen Source: rpcgen Stub code Implementation Client stub Client code Server stub Server code clnt = clnt_create(server, MESSAGEPROG, PRINTMESSAGEVERS,...); result = printmessage_1(&message, clnt); int *printmessage_1(char **msg, struct svc_req *req) { static int result = 1; return(&result); Remote procedure call: SOAP HTTP RPC" use SOAP::Lite +autodispatch => uri => 'urn:', proxy => 'http://localhost/'; Perl Apps SOAP XML HTTP my $p = My::PingPong->new(10); print $p->next, "\n"; Java import org.apache.axis.client.call; import org.apache.axis.client.service;... String endpoint = "http://ws.apache.org:5049/axis/services/echo"; Service service = new Service(); Call call = (Call) service.createcall(); call.settargetendpointaddress( new java.net.url(endpoint) );... String ret = (String) call.invoke( new Object[] { "Hello!" } );
Broadcast messaging" " Multicast messaging" " " group Multicast messaging example: jgroups" Reliable multicast communication" JChannel channel=new JChannel("/home/bela/udp.xml"); channel.setreceiver(new ReceiverAdapter() { public void receive(message msg) { System.out.println("received msg from " + msg.getsrc() + ": " + msg.getobject()); } }); channel.connect("mycluster"); channel.send(new Message(null, null, "hello world")); channel.close(); Source: www.jgroups.org
" Source-specific multicast" " Any-source multicast" group " Message passing interface" File sharing" Tuple space" Message-oriented middleware"
Message passing interface" 19 MPI: Message Passing Interface" " Send / receive" " Scatter / gather" Reduce" " MPI" 20 MPI_Send MPI_Recv nodes data
" 21 (blocking)" MPI_Send" MPI_Recv" (non-blocking)" MPI_ISend" MPI_IRecv" " 22 MPI_Group_* nodes data
23 MPI(1): Broadcast" nodes MPI_Bcast data 24 MPI(2): Scatter / gather" nodes scatter gather data MPI_Scatter MPI_Gather (uniprocessor, MPI)
25 Global reduction operations: Reduce" applies similarly to all columns nodes data MPI_Reduce MPI_SUM, MPI_PROD, MPI_MAX, MPI_MIN, 26 " MPI_Barrier" MPI_Barrier " p0 p1 p2 p3
File sharing" " " Clients NFS, CIFS, WebDAV etc. File server Tuple space" Linda" JavaSpaces" import net.jini.space.javaspace;... MessageEntry msg = new MessageEntry(); msg.content = "Hello there"; Lookup finder = new Lookup(JavaSpace.class); JavaSpace space = (JavaSpace) finder.getservice(); space.write(msg, null, 60*60*1000); out()! Add tuple A TS in()! Withdraw tuple B read()! Read tuple without withdrawing it C
Message-oriented middleware" Source: The Information Bus: Architecture for Extensible Distributed Systems, SIGOPS 93. MOM example: Java Message Service Source: Java Message Service tutorial, Sun microsystems
The Impact of Copyright(C)2011 Research on Youki the Development Kadobayashi. All of rights Middleware reserved. Technology, ACM Trans. on Software Engineering Methodology, August 2008.