Distributed Systems Principles and Paradigms Maarten van Steen VU - - PowerPoint PPT Presentation

distributed systems principles and paradigms
SMART_READER_LITE
LIVE PREVIEW

Distributed Systems Principles and Paradigms Maarten van Steen VU - - PowerPoint PPT Presentation

Distributed Systems Principles and Paradigms Maarten van Steen VU Amsterdam, Dept. Computer Science Room R4.20, steen@cs.vu.nl Chapter 10: Distributed Object-Based Systems Version: December 10, 2012 Distributed Object-Based Systems 10.1


slide-1
SLIDE 1

Distributed Systems Principles and Paradigms

Maarten van Steen

VU Amsterdam, Dept. Computer Science Room R4.20, steen@cs.vu.nl

Chapter 10: Distributed Object-Based Systems

Version: December 10, 2012

slide-2
SLIDE 2

Distributed Object-Based Systems 10.1 Architecture

Remote distributed objects

Data and operations encapsulated in an object Operations implemented as methods grouped into interfaces Object offers only its interface to clients Object server is responsible for a collection of objects Client stub (proxy) implements interface Server skeleton handles (un)marshaling and object invocation

Server machine Object Client machine Proxy Same interface as object Interface State Method Client invokes a method Network Skeleton invokes same method at object Marshalled invocation is passed across network Client OS Server OS Server Skeleton Client

2 / 22

slide-3
SLIDE 3

Distributed Object-Based Systems 10.1 Architecture

Remote distributed objects

Types of objects I Compile-time objects: Language-level objects, from which proxy and skeletons are automatically generated. Runtime objects: Can be implemented in any language, but require use of an object adapter that makes the implementation appear as an object. Types of objects II Transient objects: live only by virtue of a server: if the server exits, so will the object. Persistent objects: live independently from a server: if a server exits, the object’s state and code remain (passively) on disk.

3 / 22

slide-4
SLIDE 4

Distributed Object-Based Systems 10.2 Processes

Processes: Object servers

Servant The actual implementation of an object, sometimes containing only method implementations: Collection of C or COBOL functions, that act on structs, records, database tables, etc. Java or C++ classes Skeleton Server-side stub for handling network I/O: Unmarshalls incoming requests, and calls the appropriate servant code Marshalls results and sends reply message Generated from interface specifications

4 / 22

slide-5
SLIDE 5

Distributed Object-Based Systems 10.2 Processes

Processes: Object servers

Object adapter The “manager” of a set of objects: Inspects (as first) incoming requests Ensures referenced object is activated (requires identification of servant) Passes request to appropriate skeleton, following specific activation policy Responsible for generating object references

5 / 22

slide-6
SLIDE 6

Distributed Object-Based Systems 10.2 Processes

Processes: Object servers

Local OS Request demultiplexer Object adapter Object's stub (skeleton) Server with three objects Server machine Object adapter

Observation Object servers determine how their objects are constructed

6 / 22

slide-7
SLIDE 7

Distributed Object-Based Systems 10.2 Processes

Example: Ice

main(int argc, char* argv[]) { Ice::Communicator ic; Ice::ObjectAdapter adapter; Ice::Object

  • bject;

ic = Ice::initialize(argc, argv); adapter = ic->createObjectAdapterWithEndPoints ( "MyAdapter","tcp -p 10000");

  • bject

= new MyObject; adapter->add(object, objectID); adapter->activate(); ic->waitForShutdown(); }

Note Activation policies can be changed by modifying the properties attribute of an adapter. Ice aims at simplicity, and achieves this partly by putting policies into the middleware.

7 / 22

slide-8
SLIDE 8

Distributed Object-Based Systems 10.3 Communication

Remote Method Invocation (RMI)

Basics (Assume client stub and server skeleton are in place) Client invokes method at stub Stub marshals request and sends it to server Server ensures referenced object is active: Create separate process to hold object Load the object into server process ... Request is unmarshaled by object’s skeleton, and referenced method is invoked If request contained an object reference, invocation is applied recursively (i.e., server acts as client) Result is marshaled and passed back to client Client stub unmarshals reply and passes result to client application

8 / 22

slide-9
SLIDE 9

Distributed Object-Based Systems 10.3 Communication

RMI: Parameter passing

Object reference Much easier than in the case of RPC: Server can simply bind to referenced object, and invoke methods Unbind when referenced object is no longer needed

9 / 22

slide-10
SLIDE 10

Distributed Object-Based Systems 10.3 Communication

RMI: Parameter passing

Object-by-value A client may also pass a complete object as parameter value: An object has to be marshaled:

Marshall its state Marshall its methods, or give a reference to where an implementation can be found

Server unmarshals object. Note that we have now created a copy

  • f the original object.

Object-by-value passing tends to introduce nasty problems

10 / 22

slide-11
SLIDE 11

Distributed Object-Based Systems 10.3 Communication

RMI: Parameter passing

Local object O1 Copy of O1 Remote object O2 Local reference L1 New local reference Remote reference R1 Remote invocation with L1 and R1 as parameters Copy of R1 to O2 Machine A Machine B Machine C Client code with RMI to server at C (proxy) Server code (method implementation)

Note Systemwide object reference generally contains server address, port to which adapter listens, and local object ID. Extra: Information on protocol between client and server (TCP , UDP , SOAP , etc.)

11 / 22

slide-12
SLIDE 12

Distributed Object-Based Systems 10.3 Communication

RMI: Parameter passing

Local object O1 Copy of O1 Remote object O2 Local reference L1 New local reference Remote reference R1 Remote invocation with L1 and R1 as parameters Copy of R1 to O2 Machine A Machine B Machine C Client code with RMI to server at C (proxy) Server code (method implementation)

Question What’s an alternative implementation for a remote-object reference?

12 / 22

slide-13
SLIDE 13

Distributed Object-Based Systems 10.3 Communication

Object-based messaging

Client proxy Callback interface Client RTS Client application

  • 2. Request to server
  • 4. Call by the RTS
  • 1. Call by the

application

  • 3. Response from server

Client proxy Polling interface Client RTS Client application

  • 2. Request to server
  • 1. Call by the

application

  • 3. Response from server
  • 4. Call by the

application

13 / 22

slide-14
SLIDE 14

Distributed Object-Based Systems 10.4 Naming

Object references

Observation In order to invoke remote objects, we need a means to uniquely refer to them. Example: CORBA object references.

Repository identifier IIOP version Host Port Object key Components Profile ID Tagged Profile Object identifier Adapter identifier Other server- specific information Profile Interoperable Object Reference (IOR)

14 / 22

slide-15
SLIDE 15

Distributed Object-Based Systems 10.4 Naming

Object references

Observation It is not important how object references are implemented per object-based system, as long as there is a standard to exchange them between systems.

Object system A Object system B Object server Interoperable references (Half) gateway

Solution Object references passed from one RTS to another are transformed by the bridge through which they pass (different transformation schemes can be implemented)

15 / 22

slide-16
SLIDE 16

Distributed Object-Based Systems 10.4 Naming

Object references

Object system A Object system B Object server Interoperable references (Half) gateway

Observation Passing an object reference refA from RTS A to RTS B circumventing the A-to-B bridge may be useless if RTS B doesn’t understand refA

16 / 22

slide-17
SLIDE 17

Distributed Object-Based Systems 10.4 Naming

Globe object references: location independent

Stacked address Stack of addresses representing the protocol to speak: Field Description Protocol ID Constant representing a (known) protocol Protocol addr. Protocol-specific address

  • Impl. handle

Reference to a file in a repository Instance address Contains all that is needed to talk in a propritary way to an object: Field Description

  • Impl. handle

Reference to a file in a repository Initialization string Used to initialize an implementation

17 / 22

slide-18
SLIDE 18

Distributed Object-Based Systems 10.6 Consistency and Replication

Consistency and replication

Observation Objects form a natural means for realizing entry consistency: Data are grouped into units, and protected by a synchronization variable (i.e., lock) Synchronization variables adhere to sequential consistency (i.e., values are set atomically) Operations of grouped data can be nicely grouped: object Problem What happens when objects are replicated? One way or the other we need to ensure that operations on replicated objects are properly

  • rdered.

18 / 22

slide-19
SLIDE 19

Distributed Object-Based Systems 10.6 Consistency and Replication

Replicated objects

Problem We need to make sure that requests are ordered correctly at the servers and that threads are deterministically sheduled

Middleware Local OS Threads

  • Unordered requests

Totally ordered requests Middleware Local OS Threads Thread scheduler Deterministic thread scheduling Unordered requests Object Computer 1 Computer 2 T1

1

T1

2

T2

1

T2

2

19 / 22

slide-20
SLIDE 20

Distributed Object-Based Systems 10.6 Consistency and Replication

Replicated objects

Observation We are dealing with nasty issues here. Simplicity may dictate completely serialized (i.e., single-threaded) executions at the server.

20 / 22

slide-21
SLIDE 21

Distributed Object-Based Systems 10.6 Consistency and Replication

Replicated invocations

Active replication Updates are forwarded to multiple replicas, where they are carried out. There are some problems to deal with in the face of replicated invocations

Client replicates invocation request All replicas see the same invocation Object receives the same invocation three times Replicated object A B1 B2 B3 C

21 / 22

slide-22
SLIDE 22

Distributed Object-Based Systems 10.6 Consistency and Replication

Replicated invocations

Solution Assign a coordinator on each side (client and server), which ensures that only one invocation, and one reply is sent

Coordinator

  • f object B

Result Coordinator

  • f object C

(a) (b) Client replicates invocation request B1 B1 B2 B2 B3 B3 C1 C1 C2 C2 A A Result

22 / 22