distributed systems
play

Distributed Systems Principles and Paradigms Chapter 10 (version - PDF document

Distributed Systems Principles and Paradigms Chapter 10 (version April 7, 2008 ) Maarten van Steen Vrije Universiteit Amsterdam, Faculty of Science Dept. Mathematics and Computer Science Room R4.20. Tel: (020) 598 7784 E-mail:steen@cs.vu.nl,


  1. Distributed Systems Principles and Paradigms Chapter 10 (version April 7, 2008 ) Maarten van Steen Vrije Universiteit Amsterdam, Faculty of Science Dept. Mathematics and Computer Science Room R4.20. Tel: (020) 598 7784 E-mail:steen@cs.vu.nl, URL: www.cs.vu.nl/ ∼ steen/ 01 Introduction 02 Architectures 03 Processes 04 Communication 05 Naming 06 Synchronization 07 Consistency and Replication 08 Fault Tolerance 09 Security 10 Distributed Object-Based Systems 11 Distributed File Systems 12 Distributed Web-Based Systems 13 Distributed Coordination-Based Systems 00 – 1 /

  2. Remote Distributed Objects (1/2) • Data and operations encapsulated in an object • Operations are implemented as methods , and are accessible through 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 ob- ject invocation Client machine Server machine Object Server Client State Same interface Method Client as object invokes a method Skeleton Interface invokes Proxy Skeleton same method at object Client OS Server OS Network Marshalled invocation is passed across network 10 – 1 Distributed Object-Based Systems/10.1 Architecture

  3. Remote Distributed Objects (2/2) Compile-time objects: Language-level objects, from which proxy and skeletons are automatically gener- ated. Runtime objects: Can be implemented in any lan- guage, but require use of an object adapter that makes the implementation appear as an object. 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. 10 – 2 Distributed Object-Based Systems/10.1 Architecture

  4. Example: Enterprise Java Beans What is it: Java object hosted by special server that allows for different means of calling the object by re- mote clients. Container EJB EJB EJB Server JMS JNDI JDBC RMI Services Server kernel Local OS Network 10 – 3 Distributed Object-Based Systems/10.1 Architecture

  5. Types of EJBs • Stateless session bean: Transient object, called once, does its work and is done. Example: exe- cute an SQL query and return result to caller. • Stateful session bean: Transient object, but main- tains client-related state until the end of a session. Example: shopping cart. • Entity bean: Persistent, stateful object, can be invoked during different sessions. Example: ob- ject maintaining client info on last number of ses- sions. • Message-driven bean: Reactive objects, often triggered by message types. Used to implement publish/subscribe forms of communication. 10 – 4 Distributed Object-Based Systems/10.1 Architecture

  6. Globe Distributed Objects (1/2) Observation: Most distributed objects are not dis- tributed at all: state is kept at a single node. Alterna- tive: Globe objects, which are physically distributed across multiple machines. Distributed shared object Local object Process Network Interface 10 – 5 Distributed Object-Based Systems/10.1 Architecture

  7. Globe Distributed Objects (2/2) Note: To make DSOs generic, we need to separate function from distribution support: Same interface as implemented by semantics subobject Control subobject Replication Semantics subobject subobject Communication subobject Communication with other local objects Note: replication subobject essentially decides how and when the local semantics subobject will be in- voked. 10 – 6 Distributed Object-Based Systems/10.1 Architecture

  8. Processes: Object Servers (1/2) Servant: The actual implementation of an object, some- times 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 ap- propriate servant code • Marshalls results and sends reply message • Generated from interface specifications 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 10 – 7 Distributed Object-Based Systems/10.2 Processes

  9. Processes: Object Servers (2/2) Server with three objects Server machine Object 's stub (skeleton) Object adapter Object adapter Request demultiplexer Local OS Observation: Object servers determine how their ob- jects are constructed 10 – 8 Distributed Object-Based Systems/10.2 Processes

  10. Example: Ice Important: Ice aims at simplicity , and achieves this partly by putting policies into the middleware. main(int argc, char* argv[]) { Ice::Communicator ic; Ice::ObjectAdapter adapter; Ice::Object object; ic = Ice::initialize(argc, argv); adapter = ic->createObjectAdapterWithEndPoints ( "MyAdapter","tcp -p 10000"); object = new MyObject; adapter->add(object, objectID); adapter->activate(); ic->waitForShutdown(); } Note: Activation policies can be changed by modify- ing the properties attribute of an adapter. 10 – 9 Distributed Object-Based Systems/10.2 Processes

  11. Client-to-Object Binding (1/2) Object reference: Having an object reference allows a client to bind to an object: • Reference denotes server, object, and communi- cation protocol • Client loads associated stub code • Stub is instantiated and initialized for specific ob- ject Two ways of binding: • Implicit: Invoke methods directly on the refer- enced object • Explicit: Client must first explicitly bind to object before invoking it 10 – 10 Distributed Object-Based Systems/10.3 Communication

  12. Client-to-Object Binding (2/2) Distr_object* obj_ref; obj_ref = ...; Implicit obj_ref->do_something(); Distr_object* obj_ref; Local_object* obj_ptr; Explicit obj_ref = ...; obj_ptr = bind(obj_ref); obj_ptr->do_something(); Some remarks: • Reference may contain a URL pointing to an im- plementation file • (Server,object) pair is enough to locate target ob- ject • We need only a standard protocol for loading and instantiating code Observation: Remote-object references allow us to pass references as parameters. This was difficult with ordinary RPCs. 10 – 11 Distributed Object-Based Systems/10.3 Communication

  13. Remote Method Invocation 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, invoca- tion 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 10 – 12 Distributed Object-Based Systems/10.3 Communication

  14. RMI: Parameter Passing (1/2) 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 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 of the original object. • Object-by-value passing tends to introduce nasty problems 10 – 13 Distributed Object-Based Systems/10.3 Communication

  15. RMI: Parameter Passing (2/2) Machine A Machine B Local object Remote object Local O1 Remote O2 reference L1 reference R1 Client code with RMI to server at C New local (proxy) Copy of O1 reference Remote invocation with Copy of R1 to O2 L1 and R1 as parameters Server code Machine C (method implementation) Note: Systemwide object reference generally contains server address, port to which adapter listens, and lo- cal object ID. Extra’s: Information on protocol between client and server (TCP , UDP , SOAP , etc.) Question: What ’s an alternative implementation for a remote-object reference? 10 – 14 Distributed Object-Based Systems/10.3 Communication

  16. Object-Based Messaging Messaging facilities: reliable asynchronous and per- sistent method invocations: Client application 1. Call by the application Client Callback 4. Call by the RTS proxy interface 3. Response from server Client RTS 2. Request to server Client application 1. Call by the 4. Call by the application application Client Polling proxy interface 3. Response from server Client RTS 2. Request to server 10 – 15 Distributed Object-Based Systems/10.3 Communication

  17. Object References (1/2) Observation: In order to invoke remote objects, we need a means to uniquely refer to them. Example: CORBA object references: Tagged Profile Interoperable Object Reference (IOR) Repository Profile Profile identifier ID IIOP Object key Components Host Port version Other server- Adapter Object specific information identifier identifier 10 – 16 Distributed Object-Based Systems/10.4 Naming

Recommend


More recommend