Remote Procedure Calls (RPCs) and Remote Method Invocation (RMI)
CS425/ECE428 — SPRING 2019
Remote Procedure Calls (RPCs) and Remote Method Invocation (RMI) - - PowerPoint PPT Presentation
Remote Procedure Calls (RPCs) and Remote Method Invocation (RMI) CS425/ECE428 SPRING 2019 Process communication Message passing socket.write(DEPOSIT Alice $20\n) Remote procedure calls (RPC)s deposit(Alice, 20) Remote method
CS425/ECE428 — SPRING 2019
Message passing
socket.write(“DEPOSIT Alice $20\n”)
Remote procedure calls (RPC)s
deposit(“Alice”, 20)
Remote method invocation
aliceAccount.deposit(20)
1. Create a transport connection to server 2. [Look up name of RPC] and get proxy handle 3. Call proxy with arguments 4. Process results 5. [Deal with errors]
1 2 3 4
Provides transparency by behaving like a local function/method to the invoker
Instead of executing an invocation, the proxy forwards it to a remote
2017-03-28 NIKITA BORISOV - UIUC
8
1. Send function name 2. Marshall arguments 3. Wait for response 4. Deal with errors 5. Unmarshall results 6. Return
1 2 3 4 5 6
External data representation: an agreed, platform-independent, standard for the representation
Marshalling: taking a collection of data items (platform dependent) and assembling them into the external data representation (platform independent). Unmarshalling: the process of disassembling data that is in external data representation form, into a locally interpretable form.
2017-03-28 NIKITA BORISOV - UIUC
10
message Test1 { required int32 a = 1; } message Test2 { required string b = 2; } 08 96 01 12 07 74 65 73 74 69 6e 67 t e s t i n g
2017-03-28 NIKITA BORISOV - UIUC
11
REQUEST { "jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1 } RESPONSE { "jsonrpc": "2.0", "result": 19, "id": 1 }
2017-03-28 NIKITA BORISOV - UIUC
12
Dispatcher is the front end processing all incoming requests and directing them to the appropriate skeleton implementation based
Skeleton:
1. Reads and unmarshalls arguments 2. Calls real implementation 3. Marshalls and writes results
Dispatcher is the front end processing all incoming requests and directing them to the appropriate skeleton implementation based
Skeleton:
1. Reads and unmarshalls arguments 2. Calls real implementation 3. Marshalls and writes results
Execute Reply
correct function
Execute, Crash Request Crash Request Request Execute Reply Execute Reply crash before reply crash before execution
lost request
Channel fails during reply Client machine fails before receiving reply
(and if request is received more than once?)
2017-03-28 NIKITA BORISOV - UIUC
15
Raise exception to application? Retry RPC? Semantics:
Idempotent operations are those that can be repeated multiple times, without any side effects Examples (x is server-side variable)
Non-examples
Idempotent operations can be used with at-least-once semantics
2017-03-28 NIKITA BORISOV - UIUC
17
invocation invocation remote invocation remote local local local invocation invocation A B C D E F
Process Object Process Process Host A Host B
2017-03-28 NIKITA BORISOV - UIUC
18
Translates local and remote object references Response:
2017-03-28 NIKITA BORISOV - UIUC
19
Remote object table
RRM looks up remote object references inside request and reply messages in table
2017-03-28 NIKITA BORISOV - UIUC
20
Object A Object B Comm. Module Comm. Module Skeleton for B's Class Server Process Client Process Proxy Object B Remote Reference Module Dispatcher
Proxy object is a hollow container of Method names. Remote Reference Module translates between local and remote object references. Dispatcher sends the request to Skeleton Object Skeleton unmarshals parameters, sends it to the object, & marshals the results for return
Remote Reference Module
MIDDLEWARE
2017-03-28 NIKITA BORISOV - UIUC
21
Programmer only writes object implementations and interfaces
Proxies, dispatchers, skeletons generated automatically from the specified interfaces
2017-03-28 NIKITA BORISOV - UIUC
22