Middleware Protocols From RPC to RMI Protocols for middleware services Protocols for middleware services ■ ■ ◆ Distributed commit protocols Distributed commit protocols ◆ ✦ Useful for distributed database transactions and for supporting Useful for distributed database transactions and for supporting ✦ fault fault- -tolerance tolerance ◆ Distributed locking Distributed locking ◆ High level communication services: High level communication services: ■ ■ ◆ Remote procedure call, remote object invocation, message queuing Remote procedure call, remote object invocation, message queuing ◆ services services 1 י " סשת ןסינ ג " ג The Computer Communication Cource 4 י " סשת ןסינ ג " ג The Computer Communication Cource Remote Procedure Call (RPC) Allowing programs to call procedures located on other machines Allowing programs to call procedures located on other machines ■ ■ The goal: to make remote procedure call to look as much as The goal: to make remote procedure call to look as much as ■ ■ possible as a local one possible as a local one Slides are taken from ◆ Hides communication network Hides communication network ◆ ◆ Access transparency Access transparency ◆ Issues: different address spaces, passing parameters and Issues: different address spaces, passing parameters and ■ ■ returning replies, failures returning replies, failures Topics in Distributed Middleware Systems, Spring Topics in Distributed Middleware Systems, Spring 2002 by Gregory Chockler 2002 by Gregory Chockler י " סשת ןסינ ג " ג 2 5 י " סשת ןסינ ג " ג The Computer Communication Cource Where is middleware? RPC: High level view 3 י " סשת ןסינ ג " ג The Computer Communication Cource 6 י " סשת ןסינ ג " ג The Computer Communication Cource 1
Client and Server Stubs Passing Reference Parameters Client stub: represents the remote procedure in the client Client stub: represents the remote procedure in the client’ ’s s What is the meaning of a local reference (pointer) in the remote What is the meaning of a local reference (pointer) in the remote ■ ■ ■ ■ address space address space address space?? address space?? ◆ Transforms a local invocation into a message and sends it to the Transforms a local invocation into a message and sends it to the Simulate call- Simulate call -by by- -reference by call reference by call- -by by- -copy copy- -restore for non restore for non- - ◆ ■ ■ server server recursive datatypes datatypes recursive Server stub: Server stub: ■ ■ ◆ Optimization: explicitly designate input/output parameters Optimization: explicitly designate input/output parameters ◆ ◆ Transforms request coming in over the network into local procedu Transforms request coming in over the network into local procedure re ◆ No good solution exists for arbitrary data types (e.g., graphs, No good solution exists for arbitrary data types (e.g., graphs, ■ ■ calls calls linked- linked -lists) lists) 7 י " סשת ןסינ ג " ג The Computer Communication Cource 10 י " סשת ןסינ ג " ג The Computer Communication Cource RPC Communication Protocol RPC Anatomy Client calls add(i,j) , where both i and j are integers: Common message formats for marshaling Common message formats for marshaling ■ ■ data structures data structures Common representation of simple data types Common representation of simple data types ■ ■ E.g., integers: little- E.g., integers: little -endian endian, two , two’ ’s complement; s complement; ◆ ◆ chars: 16- chars: 16 -bit Unicode bit Unicode Agreed message exchange: Agreed message exchange: ■ ■ Use TCP Use TCP ◆ ◆ Use unreliable protocol and implement an error Use unreliable protocol and implement an error ◆ ◆ control scheme control scheme foobar(char x; float y; int z[5]) 8 י " סשת ןסינ ג " ג The Computer Communication Cource 11 י " סשת ןסינ ג " ג The Computer Communication Cource Passing Value Parameters Stub Generation Different machines have different data representations Different machines have different data representations Stubs can be generated automatically from the interface Stubs can be generated automatically from the interface ■ ■ ■ ■ ◆ Characters: EBCDIC, ASCII Characters: EBCDIC, ASCII Interfaces are usually defined by means of an Interface Interfaces are usually defined by means of an Interface ◆ ■ ■ Definition Language (IDL) ◆ Integers: little Integers: little endian endian, big , big endian endian Definition Language (IDL) ◆ ◆ Allows for programming language independence Allows for programming language independence ◆ 9 י " סשת ןסינ ג " ג The Computer Communication Cource 12 י " סשת ןסינ ג " ג The Computer Communication Cource 2
RPC extensions inetd inetd inetd is the server process for the Internet standard services. is the server process for the Internet standard services. ■ ■ It is usually started up at system boot time. It is usually started up at system boot time. ■ ■ Asynchronous RPC: Asynchronous RPC: ■ ■ The configuration The configuration - - file file lists the services that lists the services that inetd inetd is to provide is to provide One One- -way RPC: don way RPC: don’ ’t wait for t wait for ◆ ◆ ■ ■ acceptance notification acceptance notification /etc/inetd /etc/ inetd.conf .conf ■ ■ daytime stream tcp nowait tcp nowait root internal root internal daytime stream ■ ■ #daytime #daytime dgram udp dgram udp wait root internal wait root internal ■ ■ time stream time stream tcp nowait tcp nowait root internal root internal ■ ■ time dgram udp wait root internal � Deferred synchronous time dgram udp wait root internal ■ ■ RPC: telnet stream telnet stream tcp nowait tcp nowait root / root /usr usr/ /sbin sbin/ /tcpd tcpd / /usr usr/ /sbin sbin/in. /in.telnetd telnetd ■ ■ 13 י " סשת ןסינ ג " ג The Computer Communication Cource 16 י " סשת ןסינ ג " ג The Computer Communication Cource portmap Distributed Comupting Environment Portmap is a server that converts RPC program numbers into is a server that converts RPC program numbers into Distributed Computing Environment (DCE) is one of the first Portmap Distributed Computing Environment (DCE) is one of the first ■ ■ ■ ■ DARPA protocol port numbers. DARPA protocol port numbers. middleware systems middleware systems It must be running in order to make RPC calls. It must be running in order to make RPC calls. Provides a diverse collection of services to simplify development Provides a diverse collection of services to simplify developmen t ■ ■ ■ ■ of distributed applications: of distributed applications: /etc/portmap portmap /etc/ ■ ■ ◆ Distributed file service, directory service, security service, Distributed file service, directory service, security service, ◆ ◆ portmapper portmapper 100000 portmap sunrpc rpcbind 100000 portmap sunrpc rpcbind ◆ distributed time, etc. distributed time, etc. ◆ rstatd rstatd 100001 rstat rup perfmeter rstat 100001 rstat rup perfmeter rstat_svc _svc ◆ Programming model: client/server Programming model: client/server ■ ■ ◆ rusersd rusersd 100002 rusers 100002 rusers ◆ Communication: RPC Communication: RPC ◆ nfs nfs 100003 nfsprog 100003 nfsprog ■ ■ ◆ ◆ … …. . ◆ Rpcinfo Rpcinfo ■ ■ 14 י " סשת ןסינ ג " ג The Computer Communication Cource 17 י " סשת ןסינ ג " ג The Computer Communication Cource DCE RPC: Writing a client and a server rpcinfo rpcinfo rpcinfo - -p p fs fs- -01 01 ■ ■ 100021 4 100021 4 tcp tcp 607 607 nlockmgr nlockmgr ■ ■ 100021 4 100021 4 udp udp 606 606 nlockmgr nlockmgr ■ ■ 100024 1 100024 1 tcp 605 status tcp 605 status ■ ■ 100024 1 100024 1 udp udp 604 status 604 status ■ ■ 100005 3 100005 3 tcp tcp 603 603 mountd mountd ■ ■ 100005 3 udp 602 602 mountd mountd 100005 3 udp ■ ■ 100003 3 100003 3 udp udp 2049 2049 nfs nfs ■ ■ 100003 2 100003 2 udp udp 2049 2049 nfs nfs ■ ■ 100000 2 100000 2 tcp tcp 111 111 portmapper portmapper ■ ■ 100000 2 100000 2 udp udp 111 111 portmapperRpcinfo portmapperRpcinfo ■ ■ 15 י " סשת ןסינ ג " ג The Computer Communication Cource 18 י " סשת ןסינ ג " ג The Computer Communication Cource 3
Recommend
More recommend