Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Brief Intro to the RPC Project Framework

Similar presentations


Presentation on theme: "A Brief Intro to the RPC Project Framework"— Presentation transcript:

1 A Brief Intro to the RPC Project Framework
COMP 117: Internet Scale Distributed Systems (Spring 2017) A Brief Intro to the RPC Project Framework Noah Mendelsohn Tufts University Web:

2 Getting the sample code
git clone /comp/117/files/RPC.samples Instructions and details in RPC assignment handout

3 TCP vs. UDP

4 Streams not messages UDP messages TCP streams COMP 117 support
Limited size Best-effort delivery If they arrive, you get the whole message at once TCP streams Reliable delivery unless connection breaks Byte streams: “unlimited” length, no message boundaries You can write 50 bytes then 30 bytes; reader can read 35 bytes then 45 You might do a 10000byte write, but reader may see only a few on first read COMP 117 support Framework: c150streamsocket.h Demo code: pingstreamclient.cpp, pingstreamserver.cpp (in RPC.samples) You do not have to submit modified versions of these

5 Review From the Earlier Lecture On Remote Procedure Call

6 RPC: Call remote functions automatically
float sqrt(float n) { …compute sqrt… return result; } x = sqrt(4) CPU Memory Storage CPU Memory Storage float sqrt(float n) { send n; read s; return s; } proxy Request invoke sqrt(4) void doMsg(Msg m) { s = sqrt(m.s); send s; } stub Response result=2 (no exception thrown) Interface definition: float sqrt(float n); Proxies and stubs generated automatically RPC provides transparent remote invocation

7 How the Demo Programs Work

8 Demo program uses function w/no arguments
This client int main() { func1() } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage

9 Demo program uses function w/no arguments
…is calling this function int main() { func1() } void func1() { return; } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage Interface definition file: simplefunction.idl void func1();

10 Demo program uses function w/no arguments
Sample proxy int main() { func1() } void func1() { return; } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage simplefunction.cpp void void() { send func1; read DONE; } simplefunction.proxy.cpp

11 Demo program uses function w/no arguments
int main() { func1() } void func1() { return; } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage simplefunction.cpp void void() { send func1; read DONE; } simplefunction.proxy.cpp Proxy and stub names always match IDL file name

12 Demo program uses function w/no arguments
int main() { func1() } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage rpcserver is generic main program…doesn’t depend on IDL or func1 void void() { send func1; read DONE; } simplefunction.proxy.cpp int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver

13 Demo program uses function w/no arguments
int main() { func1() } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp …but we name the executable to match the particular use (simplefunctionserver) int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver

14 Demo program uses function w/no arguments
All stubs provide a dispatchFunction int main() { func1() } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunction() { read from socket call __func1() } void __func1() { read args from stream call func1 send response int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver simplefunction.stub.cpp

15 Demo program uses function w/no arguments
…that reads function names from the network and calls the right stub int main() { func1() } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage void void() { send func1; read DONE; } simplefunction.proxy.cpp void dispatchFunction() { read from socket call __func1() } void __func1() { read args from stream call func1 send response int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver simplefunction.stub.cpp

16 Demo program uses function w/no arguments
int main() { func1() } void func1() { return; } simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage simplefunction.cpp void void() { send func1; read DONE; } simplefunction.proxy.cpp Response DONE Request invoke func1() void dispatchFunctiong() { read from socket call __func1() } void __func1() { read args from stream call func1 send response int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } rpcserver.cpp linked as simplefunctionserver simplefunction.stub.cpp

17 Demo program uses function w/no arguments
int main() { func1() } void func1() { return; } simplefunctionclient.cpp You’ll be implementing proxies and stubs like these…first by hand…then using your RPC generator CPU Memory Storage CPU Memory Storage simplefunction.cpp void void() { send func1; read DONE; } Response DONE Request invoke func1() void dispatchFunctiong() { read from socket call __func1() } void __func1() { read args from stream call func1 send response int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } simplefunction.proxy.cpp Interface definition file: simplefunction.idl rpcserver.cpp linked as simplefunctionserver simplefunction.stub.cpp

18 Demo program uses function w/no arguments
int main() { func1() } void func1() { return; } simplefunction.proxy.cpp & simplefunction.stub.cpp are provided for you as samples Yours will have to support other IDL files with functions that take arguments and return values! simplefunctionclient.cpp CPU Memory Storage CPU Memory Storage simplefunction.cpp void void() { send func1; read DONE; } Response DONE Request invoke func1() void dispatchFunctiong() { read from socket call __func1() } void __func1() { read args from stream call func1 send response int Main() { …loop accepting connections{ while(!eof){ dispatchFunction() } } } simplefunction.proxy.cpp Interface definition file: simplefunction.idl rpcserver.cpp linked as simplefunctionserver simplefunction.stub.cpp


Download ppt "A Brief Intro to the RPC Project Framework"

Similar presentations


Ads by Google