Title: Advanced Communication Among Distributed Objects
1Advanced Communication Among Distributed Objects
- Outline
- Request synchronization
- Request multiplicity
- Request reliability
2Request Synchronization
- Request synchronization
- Synchronous
- Wait for the results
- Oneway
- Do not expect any results or exceptions
- Request returns control to client as soon as the
middleware accepts the request - Server and Client execute concurrently
- Deferred synchronous
- Dynamic
- Explicit request object
- Invoke more than one concurrent operations with
single thread - Asynchronous
- Callback from the server to client
- Non-synchronous requests can be achieved by
synchronous requests and multi-threading - COBRA provide direct support for all 4 different
requests
3Oneway Request
- Using thread
- Spawn a child thread to make synchronous request
- Terminate the child thread once the request is
finished - Performance penalty
4Oneway Request
Class PrintSquas static void main(string
args) Team team Date date // initialization
.. OnewayReq a new OnewayReq (team,
date) a.start() // continue Class
OnewayReq extends Thread Team team Date
date OnewayReq (Team t, Date d) team t date
d public void run() team.print(date) //
call remote method
5Oneway Request
- Using thread
- Spawn a child thread to make synchronous request
- Terminate the child thread once the request is
finished - Performance penalty
- CORBA
- Static and dynamic invocation support oneway
request - IDL defines oneway operations
- Precondition
- No out, or inout parameter
- Viod return type
- No type-specific exceptions
- Static invocation, Server decides this
synchronization scheme - Dynamic invocation, client can choose oneway
request (review the Request object, send
operation.)
6Oneway Request
- CORBA
- IDL defines oneway operations
- Static invocation, Server decides this
synchronization scheme - Dynamic invocation, client can choose oneway
request
interface Team oneway void mail_timetable (in
Date date)
Server
Client
r create_request()
rRequest
send_oneway
Op()
delete()
7Oneway Request
- Comparison
- Thread
- Less efficient (Create/delete thread)
- IDL (oneway)
- Less flexible
- Type safe
- DII
- Flexible using different flag with send
- Type unsafe
- Less efficient (Create/delete request object)
8Deferred Request
- Using thread
- Spawn a child thread to make synchronous request
- Wait for termination of the child request thread
- Obtain the result
- Performance penalty
9Deferred Request --- Using Thread
- class PrintSquad
- public void print (Team team, Date date)
- DefsyncReqPrintSquad a new
DefSyncReqPrintSquad (team, date) - // do something here.
- a.join(this) // wait for request thread to die
- System.out.println(a.getResult())
-
-
- class DefSyncReqPrintSquad extends Thread
-
- DefsyncReqPrintSquad (Team t, Date d)
- Public String getResult()
- Public void run()
- strings
- s team.asString(date) // call remote method
and die -
10Deferred Request
- CORBA
- Only dynamic invocation interface support
deferred synchronous request - Cannot be issued using client stub
- get_response no-wait returns control back to
client with indication if the result is ready
Server
Client
r create_request()
rRequest
send_defeered()
Op()
get_response()
delete()
11Asynchronous Request
- Using thread
- Similar to deferred synchronous request
- Request thread invokes a call back operation
- Request thread join the main thread
12Asynchronous Request --- Using Thread
- Interface Callback
- public void result (String s)
-
- class PrintSquad implements Callback
- public void print (Team team, Date date)
- AsyncReqPrintSquad a new AsyncReqPrintSquad
(team, date, this) - a.start()
- // continue to do some work here
-
- public void result (String s) // callback
- System.out.println(s)
-
-
- class AsyncReqPrintSquad extends Thread
- Team team
- Date date
- Callback call
13Asynchronous Request
Server
Client
r create_request()
rRequest
send()
Op()
Callback ()
14Asynchronous Request
Request Queue
enter
remove
Client
Server
remove
enter
Reply Queue
15Request Multiplicity
- Request multiplicity
- Unicast (from one client to one server)
- Group request
- same operations from multiple server objects
- Group requests are anonymous
- Group composition is managed by a channel
- Group membership is unknown to the request
producer - Group members are request consumers
- Multiple request
- Different operations from different server
objects that are known to the client - Requested operations are independent with each
other with no precedence relation - Client can collect results as they become
available
16Request Multiplicity
- Implementing group request
- Channel (Example 7.5)
- CORBA Event channel (Example 7.6)
- Implementing multiple request
- Thread
- Tuple space (Example 7.8)
- Out
- In (blocking call)
- Rd (blocking call)
- Performance and development overhead
- DII (Example 7.9)
17Request Reliability
- Unicast Request Reliability
- Exactly-once
- Highest reliability
- Depends on middleware, fault-tolerant, hardware,
os platforms - Expensive
- Atomic
- Avoid side-effects when a failure occurs
- Transactions
- At-least-once
- Middleware guarantees the execution
- Multiple execution of a single request due to
reply lose - If request modify servers state, this semantics
is not desirable - At-most-once
- If not executed, errors are raised
- Maybe
- No guarantee of execution
- Client doesnt know the failure
- Oneway request in CORBA
18Request Reliability
- Group and Multiple Request Reliability
- K-reliability
- Totally ordered
- Best effort
- Trade off between performance and Reliability