Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call...
Transcript of Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call...
![Page 1: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/1.jpg)
Implementing Remote Procedure Calls
Andrew Birrell and Bruce Nelson
Presented by
Kai Cong
![Page 2: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/2.jpg)
Conventional Procedure Calls
main
proc1
proc5
proc2 proc3 proc4
proc6 proc7 proc8
Within a program on a single computer!!!
![Page 3: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/3.jpg)
Extension of the Procedural Model
main
proc1
proc5
proc2 proc3 proc4
proc6 proc7 proc8
computer1 computer2
across a netWork betWeen programs on different computers!!!
![Page 4: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/4.jpg)
4
Remote Procedure Call (RPC)
Client Server
Computing
Blocked
Blocked
Blocked
![Page 5: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/5.jpg)
RPC – How it works
client
procedure call
client stub
locate(un)marshal(de)serialize
send (receive)
server
procedure
server stub
(un)marshal(de)serialize
receive (send)
client process server process
RPC
Run
time
mod
ule
RPC
Run
time
mod
ule
![Page 6: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/6.jpg)
Issues
• Binding• Passing data• Implementation• Exceptions• RPC systems
![Page 7: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/7.jpg)
• The binding operation is to bind an importer of an interface to an exporter of an interface.
• After binding, calls made by the importer invoke procedures implemented by the remote exporter.
• static binding vs dynamic binding
Binding
![Page 8: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/8.jpg)
• static binding(not presented by the paper)– hard coded stub– simple– efficient– not flexible– stub recompilation is necessary if the location
of the server changes– use of redundant servers is not possible
Static Binding
![Page 9: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/9.jpg)
• dynamic binding– Interface: type and instance– Database
• load balancing– flexible– redundant servers is possible
Dynamic Binding
![Page 10: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/10.jpg)
client
procedure call
client stubbind
(un)marshal(de)serialize
findsend
receive
RPC
Run
time
mod
ule server
procedure
server stubregister
(un)marshal(de)serialize
receivesend
client process server process
Database
2
4
5 6
7 1
3
Dynamic Binding
RPC
Run
time
mod
ule
7
![Page 11: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/11.jpg)
Issues
• Binding• Passing data• Implementation• Exceptions• RPC systems
![Page 12: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/12.jpg)
Passing Data
• Can't use the stack!• Can't use shared memory!• Generally use message passing
![Page 13: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/13.jpg)
Passing data
Build a message that includes:• Who and what's being called• Identity of the caller• Data values in known byte order
• Using an intermediate data representation
![Page 14: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/14.jpg)
Issues
• Binding• Passing data• Implementation• Exceptions• RPC systems
![Page 15: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/15.jpg)
Implementation
![Page 16: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/16.jpg)
Implementation
• Function prototype is (almost) all that's needed to build the client stub– Also need binding information
• Function prototype is (almost) all that's needed to build server stub– Also need method to wait for message
![Page 17: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/17.jpg)
Implementation
• Stub compiler– Generates stubs for client and server– Language dependent– Compile into machine-independent format
• Transport protocol– PUP, XML, SOAP, DCOM, CORBA, …
![Page 18: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/18.jpg)
Implementation
ClientsThreaded
ServersEvent Driven
![Page 19: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/19.jpg)
Issues
• Binding• Passing data• Implementation• Exceptions• RPC systems
![Page 20: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/20.jpg)
• What can happen in "normal" procedures?
– Procedure generates an exception– Procedure infinite loops– Procedure generates wrong results
Exceptions
![Page 21: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/21.jpg)
Exceptions
• What can happen in "remote" procedures?– Client stub generates an exception– Transmission failure knowable failure unknowable failure
– Remote procedure generates an exception– Remote procedure infinite loops– Remote procedure generates wrong results
![Page 22: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/22.jpg)
Issues
• Binding• Passing data• Implementation• Exceptions• RPC systems
![Page 23: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/23.jpg)
RPC Systems Sun RPC
DCE RPC
DCOM
CORBA
Java RMI
XML RPC, SOAP/.NET, AJAX, REST
Protocol Buffers (Google)
Thrift (Facebook)
![Page 24: Implementing Remote Procedure Calls - Semantic Scholar · 2017. 7. 8. · Remote Procedure Call (RPC) Client Server. Computing. Blocked. Blocked. Blocked. RPC – How it works client](https://reader034.fdocuments.us/reader034/viewer/2022052005/6019107c42377f26bb35092b/html5/thumbnails/24.jpg)
Conclusion
• Remote Procedure Call should look and feel like local call
• Remote Procedure Call should be independent of where it executes
• Remote Procedure Call should be "efficient“