10.1. Architecture - Msec Reseach Group

fortnecessityusefulΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 10 μήνες)

112 εμφανίσεις

Docent
: Vincent Naessens





10.1. Architecture

`
10.2. Processes

`
10.3. Communication



Distributed objects


Client stub


proxy


Server stub


skeleton


State is not distributed!! (also called
remote objects
)



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




Persistent versus transient objects


Persistent object:


lifetime can be larger than lifetime of server


Transient object:


lifetime cannot be larger than lifetime of server





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



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



Enterprise Java Beans (short tutorial


see SUN)



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


Enterprise Java Beans (short tutorial


see SUN)


Step 5
: create ejb
-
jar file

1.
Compile .
java

files (
Demo, DemoHome, DemoBean
)

2.
Create deployment description
DemoBeanDD.ser

3.
Create a Manifest

4.
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

1.
Locate the demo.DemoHome

2.
Create the EJB at the server using
DemoHome

3.
Call application methods on the
DemoBean


Step 8
: run the client





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


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






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






Binding a client to an object


Implicit binding (a)
versus

explicit binding (b)


Implementation of object references



An object reference must contain enough
information to allow a client to bind to an object



Reference can contain

1.
Network address of machine

2.
Server port that manages object

3.
Indication of object


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



Implementation of object references




Adding additional information (such as marshalling
protocol)
:


Including in object reference


Making an implementation handle available at a site



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)





Parameter passing


Local objects



a copy is sent to the server (O1)


Remote objects




reference to object is sent to server (O2)






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








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










Object
-
based messaging


CORBA supports asychronous method invocation


Strategy 1: callback model


Server interface



i
nt 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








Object
-
based messaging


CORBA supports asychronous method invocation


Strategy 1: callback model



Object
-
based messaging


CORBA supports asychronous method invocation


Strategy 2: polling model


Server interface



i
nt 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








Object
-
based messaging


CORBA supports asychronous method invocation


Strategy 2: polling model






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)


NFC architecture


More detailed info about NFC


See course on system administration





12.1
. Architecture

`
12.2. Processes

`
12.3. Communication

`
12.6. Consistency and replication



Traditional web
-
based systems



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




Traditional web
-
based systems


Overview of certain MIME types




Traditional web
-
based systems


Multitiered architectures


CGI extensions


user passes CGI
-
name +parameters


CGI script is executed at server AND document is returned





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



Web services



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



Logical components of a web browser


Web proxy if browser does not speak FTP


Example
: Squid


Today
: integrated in many browsers


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


...


The Apache Web server


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



Web server clusters


Type 1:
front
-
end at TCP layer



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


Web server clusters


Type 3
: hybrid architecture


Hypertext Transfer Protocol


Nonpersistent (HTTP1.0) (a) versus persistent
connections (HTTP1.1) (b)



Hypertext Transfer Protocol


Operations







Request and response headers


SOAP = Single Object Access Protocol



Web proxy caching


Hierarchical caching


Local cache


region cache


country cache


server


Cooperative caching


Inspecting neighbouring caches of the same ORG


Replication for web hosting systems


CDN = content delivery network


Web hosting services: providing infrastructure for
distributing and replicating Web documents


Replication for web hosting systems


Metric estimation


Latency metrics: measuring delay between nodes


Spatial metrics: measuring distance between nodes


Network usage metrics: measuring consumed bandwith


Consistency metrics: measuring deviations from master copy


Financial metrics: measuring costs


Goal
: meeting service level agreements


Adaptation triggering


How to trigger adaptations?


Handling flash crowds (i.e. sudden bursts)


Adjustment measures (3 measures)

1.
Client
-
request redirection

2.
Replica placement

3.
Consistency enforcement