550 likes | 754 Views
Distributed Systems. Docent : Vincent Naessens. Chapter 10: distributed object-based systems. Chapter 10: distributed object-based systems. 10.1. Architecture 10.2. Processes 10.3. Communication. 10.1. Architecture. Distributed objects Client stub proxy Server stub skeleton
E N D
Distributed Systems Docent: Vincent Naessens
Chapter 10: distributed object-based systems • 10.1. Architecture • 10.2. Processes • 10.3. Communication
10.1. Architecture • Distributed objects • Client stub proxy • Server stub skeleton • State is not distributed!! (also called remote objects)
10.1. Architecture • Compile-time versus runtime objects • Compile-time objects • Object = instance of a class • Compilation of interfaces into client and server stubs • Neg: dependency on particular programming language • Run-time objects • Object = definition of an interface • Object implementation can be in any language • Object adapters act as a wrapper around the implementation
10.1. Architecture • Persistent versus transient objects • Persistent object: • lifetime can be larger than lifetime of server • Transient object: • lifetime cannot be larger than lifetime of server
10.1. Architecture • Enterprise Java Beans • Language + runtime support for distributed objects • EJB = Java object that is hosted by a special server offering different ways for remote clients to invoke that object • Application oriented functionality EJB • System oriented functionality JMS, JNDI, JDBC, RMI • EJB embedded in a container • Providers interfaces for underlying services
10.1. Architecture • Enterprise Java Beans (4 types) • Stateless session beans • Handling SQL query • Stateful session beans • Shopping cart • Entity beans • Long-live & persistent • Message-driven beans • React on messages
10.1. Architecture • Enterprise Java Beans (short tutorial – see SUN)
10.1. Architecture • Enterprise Java Beans (short tutorial – see SUN) • Step 1: install Enterprise JavaBeans Server • Step 2: specify the Enterprise JavaBeans Remote Interface • contains interfaces for application logic public interface Demo extends EJBObject, Remote • Step 3: specify the Home Interface • contains interface for creation of EJB public interface DemoHome extends EJBHome • Step 4: write the EJB class • contains implementation of application logic • Implements EJB remote interface public class DemoBean implements SessionBean
10.1. Architecture • Enterprise Java Beans (short tutorial – see SUN) • Step 5: create ejb-jar file • Compile .java files (Demo, DemoHome, DemoBean) • Create deployment description DemoBeanDD.ser • Create a Manifest • Create a .jar file containing the files • Step 6: deploy the DemoBean Enterprise JavaBeans • Put the bean in a container at the server • Step 7: write the Enterprise JavaBean Client • Locate the demo.DemoHome • Create the EJB at the server using DemoHome • Call application methods on the DemoBean • Step 8: run the client
10.2.Processes • Object servers • Designed to host distributed objects • Does not provide a specific service itself • Concerns of an object server • Which code to execute? • On which data to operate? • Starting a seperate thread? • Alternatives for invoking objects • 1 policy for each invocation • Different policies depending on object types
10.2.Processes • Object servers • Different activation policies • Storing transient objects in RAM and destroy it as soon as no clients are bound • Ex: calculator • Storing each object (data + code) invocation call in a seperate memory segment • Ex: for security reasons • Different threading policies • 1 server thread • 1 thread per object • automatic protection against concurrent access • 1 thread per invocation • Increases concurrency
10.2.Processes • Object adaptor • Groups objects per policy • 1 or more objects under control • Unaware of appl. interfaces • Example: • Decides when to destroy object • Generates object identifiers • Single-threaded versus multi-threaded
10.3. Communication • Binding a client to an object • Implicit binding (a) versusexplicit binding (b)
10.3. Communication • Implementation of object references • An object reference must contain enough information to allow a client to bind to an object • Reference can contain • Network address of machine • Server port that manages object • Indication of object
10.3. Communication • Implementation of object references • Disadvantages: • Server cannot be run on different port • Solution: daemon that manages servers on machine • Server cannot be run on different machine • Solution: location server keeps track of object locations • Object reference then keeps: • Address of location server • A systemwide identifier of server
10.3. Communication • Implementation of object references • Adding additional information (such as marshalling protocol): • Including in object reference • Making an implementation handle available at a site
10.3. Communication • Static versus dynamic remote method invocations • Static invocation • Object interfaces are known when client is developed • Recompilation of client if object interface changes • Ex: fobject.append(x) • Dynamic invocation • Select at runtime the method that is invoked • invoke(object,method,input_params,output_params) • Ex: invoke(fobject,id(append),x)
10.3. Communication • Parameter passing • Local objects a copy is sent to the server (O1) • Remote objects reference to object is sent to server (O2)
10.3. Communication • Example: Java RMI • Cloning an object can only be done at the server • Clients cannot clone a remote object • Only serializable objects can be cloned • Parameter passing • Local objects are passed by value • Remote objects are passed by reference • Reference of remote object consists of • (address, server endpoint, local identifier) • Encode protocol stack
10.3. Communication • Example: Java RMI • Proxies are serializable • Can be sent to other processes • Implementation handles are generated to pass code • Proxy code can be dowloaded separately • More efficient than marshalling the code itself • Note that the object state is still marshalled
10.3. Communication • Object-based messaging • CORBA supports asychronous method invocation • Strategy 1: callback model • Server interface • int add(in int i, in int j, out int k) • Client interfaces • void sendcb_add(in int i, in int j) • void replycb_add(in int ret_val, in int k) • Last one needs to be implemented by client
10.3. Communication • Object-based messaging • CORBA supports asychronous method invocation • Strategy 1: callback model
10.3. Communication • Object-based messaging • CORBA supports asychronous method invocation • Strategy 2: polling model • Server interface • int add(in int i, in int j, out int k) • Client interfaces • void sendpoll_add(in int i, in int j) • void replypoll_add(out int ret_val, out int k) • Called by application
10.3. Communication • Object-based messaging • CORBA supports asychronous method invocation • Strategy 2: polling model
Chapter 11: distributed file systems • 11.1. Architecture
11.1. Architecture • Client-server architectures • Network File System is prototypical example • Each NFS server provides a standardized view on its local file system • Communication protocol that allows file retrieval • Two file server models • Model (a): Remote access model (like NFS) • Model (b): upload download model (like FTP)
11.1. Architecture • NFC architecture
11.1. Architecture • More detailed info about NFC • See course on system administration
Chapter 12: distributed web-based systems • 12.1. Architecture • 12.2. Processes • 12.3. Communication • 12.6. Consistency and replication
12.1. Architecture • Traditional web-based systems
12.1. Architecture • Traditional web-based systems • Main part is written in a markup-language • HTML or XML • Second part consists of embedded documents • MIME type is associated to each embedded document • Top-level types: text, image, video, application... • Subtypes: gif, jpeg, ... • Special note on “application types” • Some are run in separate program • Some are offered as a seperate plugin
12.1. Architecture • Traditional web-based systems • Overview of certain MIME types
12.1. Architecture • Traditional web-based systems • Multitiered architectures • CGI extensions • user passes CGI-name +parameters • CGI script is executed at server AND document is returned
12.1. Architecture • Web services • Examples: weather reporting service, naming service, electronic supplier, ... • Standardization in • How services are described • How services are looked up • UDDI = Universal Description, Discovery and Integration standard • WSDL = Web Services Definition Language • Some kind of IDL • SOAP = Simple Object Access Protocol • Standardization of communication between processes
12.1. Architecture • Web services
12.1. Architecture • Web services • Web services composition • Bookstore consists of multiple providers • Book order service • payment service • delivery service • Web services coordination • Standardization of coordination protocols • Single coordinator versus distributed coordination • Standardisation of web services coordination
12.2. Processes • Logical components of a web browser
12.2. Processes • Web proxy if browser does not speak FTP • Example: Squid • Today: integrated in many browsers
12.2. Processes • The Apache Web server • Extensible and flexible • Hook = specific set of functions • Hook 1: translate URL to local file name • Hook 2: writing information to a log • Hook 3: checking access rights • ...
12.2. Processes • The Apache Web server
12.2. Processes • Web server clusters • Replication of servers to enhance performance • Front end redirects client requests • Type 1: front-end at TCP layer • Forwarding HTTP requests/responses • communication bottleneck • TCP handoff • Solves communication bottleneck • Disadvantage: • Decisions are based on load, not on contents of requests
12.2. Processes • Web server clusters • Type 1: front-end at TCP layer
12.2. Processes • Web server clusters • Replication of servers to enhance performance • Front end redirects client requests • Type 2:Content-aware request distribution • Disadvantage: no TCP handoff possible • Type 3: hybrid architecture • See figure on next slide
12.2. Processes • Web server clusters • Type 3: hybrid architecture
12.3. Communication • Hypertext Transfer Protocol • Nonpersistent (HTTP1.0) (a) versus persistent connections (HTTP1.1) (b)
12.3. Communication • Hypertext Transfer Protocol • Operations • Request and response headers