Lecture Three
1
Models of distributed systems
Interaction Models Architecture Models
Synchronous Distributed Systems Client-server
Example : procedural interaction(RPC)
Master/slave
Asynchronous Distributed Systems
Example : Message passing)
Peer to peer
Mobile Agent
Client-Server Model
Multiple
Single server Proxy server Mobile code
servers
4
Model View Control
5
Model View Control (MVC)in Java
• Model: Enterprise Beans with data in the DBMS
– JavaBean: a class that encapsulates objects and can be displayed graphically
–
• Control: Servlets create beans, decide which JSP to return
– Servlet object do the bulk of the processing
• View: The JSPs (Java Server Page) generates the presentation layer ( the browser)
6
Request
7
Model: Layer for storing data and support database functionalities.
View: UI(User Interface) layer. It provides the visualization of the data and keep a track of the
user’s action in order to notify the Presenter.
Presenter: accept the request from view and fetch the data from the model and applies the
UI logic to decide what to display.
8
Master-slave architectures
• Master-slave architectures are commonly used in real-time systems
where there may be separate processors associated with data collecting
from the system’s environment.
• The ‘master’ process is usually responsible for computation, coordination
and communications and it controls the ‘slave’ processes.
• ‘Slave’ processes are dedicated to specific actions, such as collecting data
from an array of sensors.
9
A traffic management system with a
master-slave architecture
10
Peer to peer systems
Distributed component architectures
11
Peer-to-peer Systems
P eer 2
P eer 1
Application
Application
Sharable P eer 3
objects
Application
P eer 4
Application
P eers 5 .... N
12
Distributed component architectures
• There is no distinction in a distributed component
architecture between clients and servers.
• Each distributable entity is a component that provides
services to other components and receives services from
other components.
• Component communication is through a middleware
13
system.
Distributed Object Architecture
o1 o2 o3 o4
S (o1) S (o2) S (o3) S (o4)
Software bus
o5 o6
S (o5) S (o6)
14
Benefits of distributed component architecture
• It is a very open system architecture that allows
new resources to be added as required.
• The system is flexible, scalable, and reliable.
15
Models of distributed systems
Cluster and Grid computing
What is a cluster?
• A cluster is a type of parallel or distributed processing system, which
consists of a collection of interconnected stand-alone computers
cooperatively working together as a single, integrated computing
resource.
• In cluster computing parallel and distributed computing
techniques are applied to the solution of computationally
intensive applications across networks of computers.
Cluster applications:
– Applications that needs high computational power,
such as weather modeling, airplanes simulations, science
computation, digital Biology, nuclear simulations, image
processing, data mining, and astrophysics
Science Digital Biology Aerospace Resources
Computation Exploration
What is Grid Computing?
The grid is a hardware/software infrastructure that enables
heterogeneous geographically separated clusters of processors to be
connected in a virtual environment.
– Heterogeneous: The computer configurations are highly varied.
– Clusters: Generally high performance computer configurations consisting of
tens or hundreds of processors that interact through interconnections.
Mobile Agent
Agent
• In our life an agent is the person who does an useful activity on
the behalf of other person.
• A software agent is a machine running software program that is
intelligent enough to take decision with himself without human
interface.
• A software agent may be a “Stationary Agent” or a “Mobile
Agent”. .
Stationary Agent
• A stationary agent executes only on the system on which it
begins execution. If it needs information which is not on that
system or needs to interact with an agent on another system it
uses a communication mechanism.
• These communication mechanisms follows the client server
model such as RPC.
• RPC(Remote Procedure Call)
Modern distributed computing paradigm
Client-Server Code on Demand
Download (Applet)
Server
Server
Client Client
calculations calculations calculations
Mobile Agent
Node Node
Calculation and Network Calculation and
data data
Host Host
Mobile agent
• Mobile agents refer to self-contained programs
(code and execution status) that can move over
the network and act on behalf of the user.
• Mobile agents are widely used for handling
disconnected operations in distributed, mobile,
and wireless networking environment.
Mobile agent
Mobile agent technology offers a new computing paradigm in
which a program, in the form of a software agent, can suspend
its execution on a host.
Then it transfer itself to another agent-enabled host on the
network, and resume execution on the new host.
Migrate from A to B Migrate from B to C
Host A Host B Host C
Mobile Agent migrates between hosts
• Not only the code that migrate between nodes.
• The Code migrates with its execution status.
Mobile Agent is a composition of software and data which is able
to migrate (move) from one host to another autonomously. Then
it continue its execution on the destination host.
Sender host Receiver host
Suspension Execution resumption
Serialization and saving variables
and execution states Deserialization
Encoding Decoding
Dispatch Receipt
Network
Agent transfer
mobile agent migration process
Evolution of the “mobile agent” paradigm
Parameters (data)
Remote Procedure Call RPC
Client Server
Result (data)
Migrate
Node 1 Node 2
Mobile Agent
Agent Code Data Migrate
Agent
,and Context
Dispatch
Migrate
Home Node n
Mobile Agent verses RPC
Benefits of mobile agents
Bandwidth conservation.
By moving the agent (code) to the location of the required data instead
of transferring a large number of data across the network.
Overcome network latency
After the mobile agent migrates to the desired host where the data is
found there is no need to exchange data with it until it complete its
task.
Reduction of execution time.
The data is accessed locally at its source which decreases the execution
time
• Asynchronous (disconnection) communication.
There is no required synchronized between the client and the
server ,and they may be physically disconnected until the agent
finishes its task.
• Parallel computation.
The cloning features of the mobile agent allow tasks to be
processed in parallel using the required number of agents (e.g.
parallel search)
Bandwidth conservation
Text documents,
numerical data, etc.
Dataset Calculation
software
Client Server
Dataset
Host A Host B
Bandwidth conservation in Mobile Agent paradigm
Different events in a Mobile Agent’s life-time
• Creation: when a brand new agent is born and its state and variables
are initialized.
• Dispatch: when an agent leaves its current host and travels to a new
host.
• Cloning: when a twin agent is born from an original agent and the
current state of the original is duplicated.
• Deactivation: when an agent is put to sleep and its state is saved .
• Activation: when a deactivated agent is brought back to life and its
state is restored .
• Retraction: when an agent travels from a remote host to its home
machine.
• Disposal: when an agent life time is terminated and its state is lost
forever.
• Communication: when a mobile agent interact other agents.
Standardization of mobile agent
• There are various mobile agent system available such as Agent Tcl ,
Java Aglets, malib for Python, MOA, and Grasshopper.
• These systems differ widely in architecture and implementation
and in the language used for the development of the mobile
agent.
• Many effort was done to develop a standardization for different
mobile agent systems.
37
• Data collection from many places.
• Mobile agents have can travel sequentially to
many sites to collect required data.
– e.g. compare different prices from different sites
• Searching and filtering
• Given the ever increasing amount of information
available on the Internet, mobile agents can use its
cloning features to perform parallel search.
• e.g. Searching for a web service
Search example for Web
MA
Server1
Searching Multi mobile
client agents to MA Server 1
interface search
MA
Server 1
• Monitoring
• Sometimes an application needs to collect status
or detect errors from several nodes.
– e.g. Monitoring status of electrical power stations
Mobile agent systems should support the
following features
• Create
• Dispatch
• Clone
• Retract
• Deactivate
• Activate
• Dispose
The aglet package provide a library of Java classes that support the
creation and running of aglets. Aglets can run of nodes supporting mobile
agent execution.
malib is a python library that implements an application framework for
mobile agents, that is executed on foreign machines. The mobile agent can
call methods of an api object.
• Aglets are autonomous agents because once you
start them, they decide where they will go and what
they will do.
• They can receive requests from external sources, but
each individual aglet decides whether or not to
comply with external requests.
To create an aglet, you must import aglet package, then extend class
Aglet, which includes several methods you can override to customize
the behavior of your aglet.
Import aglet.*; // import aglet class features and properties e.g. (ibm.aglet.*;)
Public class MyFirstAglet extends Aglet
The onCreation() method is invoked only once in an aglet's
lifetime and should be used only for initialization.
import aglet.*;
Public class MyFirstAglet extends Aglet
Public void onCreation (Object init)
{
//Do some initialization here...
}
Example for a mobile agent that writes
Hello World when it is created
import ibm.aglet.*;
import ibm.aglet.event.*;
public class HelloWorld extends Aglet {
public void onCreation(Object init) {
System.out.println("Hello World.");
}
}
• Each time the Aglet arrived at a new host, a method called onArrival( )
would be invoked to perform any initialization.
• Then run() would be invoked.
Public void onArrival ()
{
// new host initialization
}
Public void run()
{
// Do something here...
}
• To push the agent to the new host a transfer protocol is
used to bring the aglet (code and variables state
information) safely over the network.
• dispatch( ) method to push the agent to new host.
• dispatch(new URL(“http://some.host.com"));
• onDispatch( ) -- called before a dispatch
• Variable and execution status are saved and would
migrate with the aglet.
• Dispatch (URL)
• onDispatch()
• Save variables and status
• Push agent to new host (URL).
• Agent is serialized, sent over network, received,
with state (heap not stack), and execution continued
in run method.
Import aglet.*;
Public class MyFirstAglet extends Aglet
Public void onCreation(Object init)
{
//Do some initialization here...
}
Public void run()
{
// Do something here...
dispatch(new URL(“http://some.host.com")); // ondispatch() is called automatically
}
Public void onArrival ()
{
// new host initialization
}
Public void run()
{
// Do something here...
}
• An organic search engine software spider is a piece of software that
acts like an electronic librarian who cuts out the content pages of
every book of library in the world sorts them into a extremely large
master index.
• The basic principal is that the index is made from the actual content of
site.
• Crawling is the discovery process in which search engines send out a team of
robots (known as crawlers or spiders) to find new and updated content.
• Content can vary it could be a webpage, an image, a video, a PDF, etc.
• Regardless of the format, content is discovered by links
Crawling is done using software Robots (Spiders)
There isn't a central registry of all web pages, so Google must constantly search for
new pages and add them to its list of known pages.
• Some pages are known because Google has already visited them before.
• Other pages are discovered when Google follows a link from a known page to a
new page.
• Still other pages are discovered when a website owner submits a list of pages (a
sitemap) for Google to crawl.
• If you're using a managed web host, such as Wix or Blogger, they might tell
Google to crawl any updated or new pages that you make.