presentación de powerpoint · 2020. 6. 6. · o pac advantages separation of concerns identifies...

154
Software Architecture School of Computer Science University of Oviedo Runtime Jose E. Labra Gayo Course 2019/2020

Upload: others

Post on 27-Sep-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Runtime

Jose E. Labra GayoCourse 2019/2020

Page 2: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Runtime behaviour

Also called: Components and connectors

Page 3: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Taxonomy

Page 4: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Batch

Pipes & Filters

Pipes & Filters with uniform interface

Page 5: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Batch

Independent programs are executed sequentially

Data is passed from one program to the next

NoteBatch style = grandfather of software architectural styles

Stage

Write port

Stage

Stage

ConnectorStage

Read port

Page 6: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Batch

Elements:

Independent executable programs

Constraints

Output of one program is linked to input of the next

A program usually waits for the previous one to

finish its execution

Page 7: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Batch

Advantages

Low coupling between

components

Re-configurability

Debugging

It is possible to debug each

input independently

Challenges

It does not offer interactive interface

Requires external intervention

No support for concurrencyLow throughput

High latency

Definitions: Throughput: rate at which something can be processed.

Example: number of jobs/secondLatency: time delay experienced by a process

Example: 2 seconds

Page 8: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters

Data flows through pipes and is processed by filters

Filter

Filter

Filter

Pipe

Filter

Filter Filter

Write port

Read port

Page 9: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters

Elements

Filter: component that transforms data

Filters can be executed concurrently

Pipe: Takes output data from one filter to the input of

another filter

Properties: buffer size, data format, interaction protocol

Page 10: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters

Constraints

Pipes connect outputs from one filter to inputs of other

filters

Filters must agree on the exchange format they admit

Page 11: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters

AdvantagesBetter understanding of

global systemTotal behavior = sum of each

filter behavior

Reusability: Filters can be recombined

Evolution and extensibility: It is possible to create/add

new filtersIt is possible to substitute old

filters by new ones

TestabilityIndependent verification of

each filter

PerformanceIt enables concurrent

execution of filters

Challenges

Possible delays in case of long pipes

It may be difficult to pass complex data structures

Non interactivityA filter can not interact with

its environment

Page 12: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters

Examples & Applications

Unix

who | wc -l

Java

Clases java.io (PipedReader, PipedWriter)

Yahoo Pipes

Page 13: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters - uniform interface

Variant of Pipes & Filters where filters have the

same interface

Elements

The same as in Pipes & Filters

Constraints

Filters must have a uniform interface

Page 14: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Pipes & Filters - uniform interface

Advantages:

Independent development of filters

Re-configurability

Facilitates system understanding

Challenges:

Performance can be affected if data have to be

converted to the uniform interface

Marshalling

Page 15: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Pipes & Filters - uniform interface

Examples:

Unix operating system

Programs with a text input (stdin) and 2 text outputs

(stdout y stderr)

Web architecture: REST

Page 16: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Master-Slave

Page 17: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Master-Slave

Master divides work in sub-tasks

Assigns each sub-task to different nodes

The computational result is obtained as the

combination of the slaves results results

Slave 1 Slave 2

Master

Slave N. . .

Problem

task 1 task 2 task N

Solution

result Nresult 2result 1

Page 18: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Master-Slave

Elements

Master: Coordinates execution

Slave: does a task and returns the result

Constraints

Slave nodes are only in charge of the computation

Control is done by the Master node

Page 19: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Master-Slave

Advantages

Parallel computation

Fault tolerance

Challenges

Difficult to coordinate work between slaves

Dependency on Master node

Dependency on physical configuration

Page 20: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Master-Slave

Applications:

Process control systems

Embedded systems

Fault tolerant systems

Search systems

Page 21: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

MVC: Model - view - controller

MVC variants

PAC: Presentation - Abstraction - Control

Page 22: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MVC

MVC: Model - View - Controller

Proposed by Trygve Reenskaug (end of 70's)

Solution for GUI

Controller separates model from the view

"Mental model" offered through views

Page 23: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MVC

ElementsModel: represents business logic and state

View: Offers state representation to the user

Controller: Coordinates interaction, views and model

MentalModel

Controller

Model

View 1

View 2

User

Page 24: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MVC

Constraints

Controller processes user events

Creates/removes views

Handles interaction

Views only show values

Models are independent of controllers/views

Page 25: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MVC

AdvantagesSupports multiple views of

the same model

Views synchronization

Separation of concernsInteraction (controller),

state (model)

It is easy to create new views and controllers

Easy to modify look & feel

Creation of generic frameworks

Challenges

Increases complexity of GUI development

Coupling between controllers and views

Controllers/Views should depend on a model interface

Some difficulties for GUI tools

Page 26: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MVC

Applications

Lots of web frameworks follow MVC

Ruby on Rails, Spring MVC, Play, etc.

Some variants

Push: controllers send orders to views

RoR

Pull: controllers receive orders from views

Play

Page 27: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MVC variants

PAC

Model-View-Presenter

Model View ViewModel

...

Page 28: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do PAC

PAC: Presentation-Abstraction-Control

Hierarchy of agents

Each agent contains 3 components

PresentationAbstraction Control

PAC Agent

PresentationAbstraction Control

PAC Agent

PresentationAbstraction Control

PAC Agent

Page 29: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do PAC

Elements

Agents with

Presentation: visualization aspects

Abstraction: data model of an agent

Control: connects presentation and abstraction

components and enables communication between

agents

Hierarchical relationship between agents

Constraints

Each agent is in charge of some functionality

There is no direct communication between abstraction

and presentation in each agent

Communication through the control component

Page 30: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do PAC

AdvantagesSeparation of concerns

Identifies functionalities

Support for changes and extensionsIt is possible to modify an

agent without affecting others

MultitaskAgents can reside in different

threads, processes or machines

ChallengesComplexity of the system

Too many agents can generate a complex structure which can be difficult tom maintain

Complexity of control componentsControl components handle

communication

Quality of control components is important for the whole quality of the system

PerformanceCommunication overload

between agents

Page 31: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do PAC

Applications

Network monitoring systems

Mobile robots

Drupal is based on PAC

Relationships

This patterns is related with MVC

MVC has no agent hierarchy

This pattern was re-discovered as Hierarchical MVC

Page 32: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Shared data

Blackboard

Rule based

Page 33: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Shared data

Independent components access the same state

Applications based on centralized data repositories

Component Component

SharedData

Component...

Page 34: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Shared data

Elements

Shared data

Database or centralized repository

Components

Processors that interact with shared data

Component Component

SharedData

Component...

Page 35: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Shared data

Constraints

Components interact with the global state

Components don't communicate between each other

Only through shared state

Shared repository handles data stability and consistency

Page 36: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Shared data

Advantages

Independent

components

They don't need to be

aware of the

existence of other

components

Data consistency

Centralized global state

Unique Backup of all

the system state

ChallengesUnique point of failure

A failure in the central repository can affect the whole system

Distributing the central data can be difficult

Possible bottleneckInefficient communication

Problems for scalability

Synchronization to access shared memory

Page 37: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Shared data

Applications

Lots of systems use this approach

Some variants

This style is also known as:

Shared Memory, Repository, Shared data, etc.

Blackboard

Rule based systems

Page 38: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Blackboard

Complex problems which are difficult to solve

Knowledge sources solve parts of the problem

Each knowledge source aggregates partial solutions

to the blackboard

KnowledgeSource

KnowledgeSource

Blackboard

KnowledgeSource ...

Control

Page 39: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Blackboard

Elements

Blackboard: Central data repository

Knowledge source: solves part of the problem and

aggregates partial results

Control: Manages tasks and checks the work state

Knowledgesource

Knowledgesource

Blackboard

Knowledgesource ...

Control

Page 40: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Blackboard

Constraints

Problem can be divided in parts

Each knowledge source solves a part of the

problem

Blackboard contains partial solutions that are

improving

Knowledgesource

Knowledgesource

Blackboard

Knowledgesource ...

Control

Page 41: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Blackboard

Advantages

Experimentability

Can be used for open

problems

Facilitates strategy

changes

Reusability

Knowledge sources

can be reused

Fault tolerance

ChallengesDebugging

No warranty that the right solution will be found

Difficult to establish control strategy

PerformanceIt may need to review

incorrect hypothesis

High development costParallelism implementationIt is necessary to synchronize

blackboard access

Page 42: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Blackboard

Applications

Some speech recognition systems

HEARSAY-II

Pattern recognition

Weather forecasts

Games

Analysis of molecular structure

Crystalis

Page 43: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Rule based systems

Variant of shared memory

Shared memory = Knowledge base

Contains rules and facts

InferenceEngine

Knowledge baseRules + facts

UserInterface

Page 44: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Rule based systems

Elements:

Knowledge base: Rules and facts about some

domain

User interface: Queries/modifies knowledge base

Inference engine: Answers queries from data and

knowledge base

InferenceEngine

Knowledge baseRules + facts

UserInterface

Page 45: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Rule based systems

Constraints:

Domain knowledge captured in knowledge base

Limit imperative access to knowledge base

It is based on rules like:

IF antecedents THEN consequent

Limits expressiveness with regards to imperative

languages

InferenceEngine

Knowledge baseRules + facts

UserInterface

Page 46: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Rule based systems

AdvantagesMaintainability

It may be easy to modify the knowledge base

Specially tailored to be modified by domain experts

Separation of concernsAlgorithm

Domain knowledge

Reusability

Challenges

Debugging

Performance

Rules creation and maintenance

Introspection

Automatic rule learning

Runtime update of rules

Page 47: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Rule based systems

Applications

Expert system

Production systems

Rules libraries in Java

JRules, Drools, JESS

Declarative, rule based languages

Prolog (logic programming)

BRMS (Business Rules Management Systems)

Page 48: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Call-return

Client-Server

Event based architectures

Publish-Subscribe

Actor models

Page 49: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Call-return

A component calls another component and waits

for the answer

Component A Component B

call

return

Page 50: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Call-return

Elements

Component that does the call

Component that sends the answer

Constraints

Synchronous communication:

The caller waits for the answer

Componente A Componente B

call

return

Page 51: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Call-return

Advantages

Easy to implement

Challenges

Problems for concurrent computation

If component is blocked waiting for the answer

It can be using unneeded resources

Distributed environments

Little utilization of computational capabilities

Page 52: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-Server

Variant of layers

2 layers physically separated (2-tier)

Functionality is divided in several servers

Clients connect to services

Interface request/response

Network

request

response

clientserver

Page 53: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-Server

Elements

Server: offers services through a query/answer

protocol

Client: does queries and process answers

Network protocol: communication management

between clients and servers

Network

request

response

clientserver

Page 54: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-Server

Constraints

Clients communicate with servers

Not the other way

Clients are independent from other clients

Servers don't have knowledge about clients

Network protocol establishes some communication

warrantiesNetwork

request

response

clientserver

Page 55: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-Server

Advantages

Distribution

Servers can be distributed

Low coupling

Separation of functionality

between clients/servers

Independent development

Scalability

Availability

Functionality available to all

clients

But not all the servers need

to offer all functionality

ChallengesEach server can be a single

point of failureServer attacks

Unpredictable performanceDependency on the system

and the network

Problems when servers belong to other organizationsHow can quality of service

be warranted?

Page 56: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-Server

Variants

Stateless

Replicated server

With cache

Page 57: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Network

Client-Server stateless

Constraint

Server does not store information about clients

Same query implies same answer

query

answer

clientserver

Page 58: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-Server stateless

Advantages

Scalability

Challenges

Application state management

Client must remember requests

Handle information between requests

Page 59: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Network

Replicated server

Constraint

Several servers offer the same service

Offer the client the appearance that there is only one

server

query

answerclient

server

server

server

AbstractServer

Page 60: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Replicated server

Advantages

Better answer times

Less latency

Fault tolerance

Challenges

Consistency management between replicated

servers

Synchronization

Page 61: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-server with cache

Cache = mediator between client/server

Stores copies of previous answers to the server

When a query is received it return the cached answer

without asking the original server

Networkquery

answerclient server

Cache

Page 62: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-server with cache

Elements:

Intermediate cache nodes

Constraints

Some queries are directly answered by the cache

node

Cache node has a policy for answer management

Expiration time

Page 63: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Client-server with cache

Advantages:

Less network

overload

Lots of repeated

requests can be

stored in the cache

Less answer time

Cached answers

arrive earlier

Challenges

Complexity of configuration

Expiration policy

Not appropriate for certain domains

When high fidelity of answers is needed

Example: real time systems

Page 64: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Event based

EDA (Event-Driven-Architecture)

EventProducer

EventProcessor

EventConsumer

event event

Page 65: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Event based

Elements:

Event:

Something that has happened (≠ request)

Event producer

Event generator (sensors, systems, ...)

Event consumer

DB, applications, scorecards, ...

Event processor

Transmission channel

Filters and transforms events

EventProducer

EventProcessor

EventConsumer

event event

Page 66: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Event based

Constraints:

Asynchronous communication

Producers generate events at any moment

Consumers can be notified of events at any moment

Relationship one-to-many

An event can be sent to several consumers

Page 67: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Event based

AdvantagesDecoupling

Producer does not depend on consumer, nor vice versa.

TimelessnessEvents are published

without any need to wait for the termination of any cycle

AsynchronousIn order to publish an

event there is no need to finish any process

Challenges

Non sequential execution

Possible lack of control

Difficult to debug

Page 68: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Event based

Applications

Event processing networks

Event-Stream-Processing (ESP)

Complex-event-processing

Variants

Publish-subscribe

Actor models

Page 69: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Publish-subscribe

Components subscribe to a channel to receive

messages from other components

Component

Event BusSubscribePort

PublishPort

Component

Component Component

Component

Page 70: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Publish-subscribe

Elements:

Component:

Component that subscribes to a channel

Publication port

It is registered to publish messages

Subscription port

It is registered to receive some kind of messages

Event bus (message channel):

Transmits messages to subscribers

Event Bus SubscribePort

PublishPort

Component Component

Component Component Component

Page 71: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Publish-subscribe

Constraints:

Separation between subscription/publication port

A component may have both ports

Non-direct communication

Asynchronous communication in general

Components delegate communication responsibility to

the channel

Event Bus SubscribePort

PublishPort

Component Component

Component Component Component

Page 72: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Publish-subscribe

Advantages

Communication quality

Improves performance

Debugging

Low coupling between

components

Consumers do not

depend on publishers

...nor vice versa...

Challenges

It adds a new indirection level

Direct communication may be more efficient in some domains

Complex implementation

It may require COTS

Page 73: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Actor models

Used for concurrent computation

Actors instead of objects

There is no shared state between actors

Asynchronous message passing

Theoretical developments since 1973 (Carl Hewitt)

Page 74: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Actor models

Elements

Actor: computational entity with state

It communicates with other actors sending messages

It process messages one by one

Messages

Addresses: Identify actors (mailing address)

Page 75: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Actor models

Constraints

An actor can only:

Send messages to other actors

Messages are immutable

Create new actors

Modify how it will process next message

Actors are decoupled

Receiver does not depend on sender

Page 76: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Actor models

Constraints (2)

Local addresses

An actor can only send messages to known addresses

Because they were given to it or because he created them

Parallelism:

All actions are in parallel

No shared global state

Messages can arrive in any order

Page 77: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Actor models

Challenges

Message sending

How to handle arriving

messages

Actor Coordination

Non-consistent systems

by definition

Advantages

Highly parallel

Transparency and scalability

Internal vs external addresses

Non-local actor modelsWeb Services

Multi-agent systems

Page 78: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Actor models

Implementations

Erlang (programming language)

Akka (library)

Applications

Reactive systems

Examples: Ericsson, Facebook, twitter

Page 79: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

BrokerPeer-to-peerMapReduceLambda arquictectureKappa architecture

Network

Page 80: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Broker

Intermediate node that manages communication

between a client and a server

Client ServerBrokerstub skeleton

Client ServerBrokerstub skeleton

bridge

Page 81: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Broker

Elements

Broker

Manages communication

Client: Sends requests

Client Proxy: stub

Server: Returns answers

Server Proxy: skeleton

Bridge: Can connect brokers

Client ServerBrokerstub skeleton

bridge

Page 82: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Broker

AdvantagesSeparation of concerns

Delegates low level communication aspects to the broker

Separate maintenanceReusability

Servers are independent from clients

PortabilityBroker = low level aspects

InteroperabilityUsing bridges

Challenges

PerformanceAdds an indirection layer

Can increase coupling between components

Broker = single point of failure

Page 83: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Broker

Applications

CORBA and distributed systems

Android uses a variation of Broker pattern

Page 84: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Peer-to-Peer

Equal and autonomous nodes (peers) that

communicate between them.

Network

Peer

Peer

Peer

Peer

Peer

Peer

Page 85: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Peer-to-Peer

Elements

Computational nodes: peers

They contain their own state and control thread

Network protocol

Constraints

There is no main node

All peers are equal

Page 86: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Peer-to-Peer

Advantages

Decentralized information

and control

Fault tolerance

There is no single point of

failure

A failure in one peer does

not compromise the

whole system

Challenges

Keeping the state of the system

Complexity of the protocol

Bandwidth Limitations

Network and protocol latency

Security

Detect malicious peers

Page 87: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Peer-to-Peer

Popular applications

Napster, BitTorrent, Gnutella, ...

This architecture style is not only to share files

e-Commerce (B2B)

Collaborative systems

Sensor networks

Blockchain

...

Variants

Super-peers

Page 88: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce

Proposed by GooglePublished in 2004

Internal implementation by Google

Goal: big amounts of dataLots of computational nodes

Fault tolerance

Write-once, read-many

Style composed of:Master-slave

Batch

Big Data

Map Reduce

Result

Page 89: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce

Elements

Master node: Controls execution

Node table

It manages replicated file system

Slave nodes

Execute mappers, reducers

Contain replicated data blocks

Big Data

Map Reduce

Result

Page 90: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce - Scheme

Inspired by functional programming

2 components: mapper and reducer

Data are divided for their processing

Each data is associated with a key

Transforms [(key1,value1)] to [(key2,value2)]

c1

Input: [(key1,value1)]

v1

c1 v1

c1 v1

Output: [(key2,value2)]

c2 v2

c2 v2

c2 v2

c2 v2

MapReduce

Page 91: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Step 1: mapper

mapper: (Key1, Value1) [(Key2,Value2)]

c1 vi1

c2 vi2

c3 vi3

k1 v1

k2 v2

k1 v3

k3 v4

k1 v5

k1 v6

k3 v7mapper

mapper

mapper

Page 92: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Step 2: Merge and sort

System merges and sorts intermediate results

according to the keys

k1 v1

k2 v2

k1 v3

k3 v4

k1 v5

k1 v6

k3 v7

k1 v1 v3 v5 v6

k2 v2

k3 v4 v7

Mergeandsort

Page 93: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Step 3: Reducers

reducer: (Key2, [Value2]) (Key2,Value2)

k1 v1 v3 v5 v6

k2 v2

k3 v4 v7 reducer

reducer

reducer vf1

vf2

vf3

k1

k2

k3

Page 94: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce - general scheme

c1 vi1

c1 vi1

c1 vi1 mapperreducer

reducer

reducer vf1

vf2

vf3

k1

k2

k3

mapper

mapper

k1 v1

k2 v2

k1 v3

k3 v4

k1 v5

k1 v6

k3 v7

k1 v1 v3 v5 v6

k2 v2

k3 v4 v7

Mergeandsort

MapReduce

Page 95: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce - count words

d1 a b

d2 a c a

d3 a c

4

1

2

a

b

c

a 1

b 1

a 1

c 1

a 1

a 1

c 1

mapper

mapper

mapper

reducer

reducer

reducera 1 1 1 1

b 1

c 1 1

Mezcla

y

ordena

MapReduce

// return each work with 1mapper(d,ps) {for each p in ps: emit (p, 1)

}

// sum the list of numbers of each wordreducer(p,ns) {sum = 0 for each n in ns { sum += n; } emit (p, sum)

}

Page 96: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

MapReduce - execution environment

Execution environment is in charge of:

Planning: Each job is divided in tasks

Placement of data/code

Each node contains its data locally

Synchronization:

reduce tasks must wait map phase

Error and failure handling

High tolerance to computational nodes failures

Page 97: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce - File system

Google developed a distributed file system - GFS

Hadoop created HDFSFiles are divided in chunks

2 node types: Namenode (master), datanodes (data servers)

Datanodes store different chunksBlock replication

Namenode contains metadataWhere is each chunk

Direct communication between clients and datanodes

Page 98: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce - File system

Namenode

file1: (B1 – N1 N2, B2 – N1 N2 N3)file2: (B3 – N2 N3, B4 – N1 N2)file3: (B5 – N1 N3)

B1 B1

B4

B4

B5

B5

B3 B3

Client1

Client2

N1 N2 N3

DatanodesSlaves

B2

B2 B2

Master

Page 99: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce

Advantages

Distributed computations

Split input data

Replicated repository

Fault tolerant

Hardware/software heterogeneous

Large amount of data

Write-once. Read-many

Challenges

Dependency on master node

Non interactivity

Data conversion to MapReduce

Adapt input data

Convert output data

Page 100: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce: Applications

Lots of applications:

Google, 2007, 20petabytes/day, around 100,000

mapreduce jobs/day

PageRank algorithm can be implemented as

MapReduce

Success stories:

Automatic translation, similarity, sorting, ...

Other companies: last.fm, facebook, Yahoo!, twitter, etc.

Page 101: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do MapReduce: Applications

ImplementationsGoogle (internal)

Hadoop (open source)

LibrariesHive (Hadoop): query language inspired by SQL

Pig (Hadoop): specific language that can define data flows

Cascading: API that can specify distributed data flows

Flume Java (Google)

Dryad (Microsoft)

Page 102: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Lambda architecture

Handle Big Data & real time analytics

Proposed by Nathan Marz, 2011

3 layersBatch layer: precomputes all data with MapReduce

Generates partial aggregate views

Recomputes from all data

Speed layer: real time, small window of dataGenerates fast real time views

Serving layer: handles queriesMerges the different views

Page 103: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Lambda architecture

Combines Real time with batch processing

New data stream

All dataHDFS

Precompute views(MapReduce)

Incrementviews

Batchrecompute

Batch layer

Processstream

Realtimeincrement

Speed layer

Serving layer

Partial

aggregate 1

Partial

aggregate N ...

Realtime view

Append only

Small window of thedata

Query

merge

Partial

aggregate 2

Page 104: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Lambda architecture

Constraints

All data is stored in the batch layer

The batch layer precomputes views

The results of the speed layer may not be accurate

Serving layer combines precomputed views

The views can be simple DBs for querying

Page 105: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Lambda architecture

Advantages

Scalability (Big data)

Real time

Decoupling

Fault tolerant

Keep all input data

Reprocessing

Challenges

Inherent complexity

Merging views can be innacurate

Losing some events

Page 106: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Lambda architecture

Applications

Spotify, Alibaba, …

Libraries

Apache Storm

Netflix Suro project

Page 107: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Kappa architecture

Proposed by Jay Krepps (Apache Kafka), 2013

Handle Big data & Real time with logs

Simplifies Lambda architecture

Removes the batch layer

Based on a distributed ordered log

Replicated cluster

The log can be very large

Page 108: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Datasource 1

Data source 2

Kappa architecture

Diagram

Data Source N

Stream ProcessingSystem

Appqueries

Append-onlyimmutable log

ServingBackend

DB. . .

Streaming layer Serving layer

Page 109: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Kappa architecture

Constraints

The event log is append-only

The events in the log are immutable

Stream processing can request events at any

position

To handle failures or doing recomputations

Page 110: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Kappa architecture

Advantages

Scalable (big data)

Real time processing

Simpler than lambda

No batch layer

Challenges

Space requirements

Duplication of log and DB

Log compaction

Ordering of events

Delivery paradigms

At least once

At most once (it may be lost)

Exactly once

Page 111: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Kappa architecture

Applications & libraries

Apache Kafka

Apache Samza

Spark Streaming

LinkedIn

Page 112: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Plugins

Microkernel

Reflection

Interpreters and DSL

Mobile code

- Code on demand

- Remote evaluation

- Mobile agents

Page 113: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

PluginPlugin

Plugins

It allows to extend the system using plugins that

add new functionality

Runtimeengine

Base system

Plugin

Page 114: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Plugins

Elements

Base system:

System that allows plugins

Plugins: Components that can be added/removed

dynamically

Runtime engine:

Starts, localizes, initializes, executes, and stops plugins

PluginPlugin

Runtimeengine

Base system

Plugin

Page 115: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Plugins

Constraints

Runtime engine manages plugins

System can add/remove plugins

Some plugins can depend on other plugins

The plugin must declare dependencies and the

exported API

PluginPlugin

Runtimeengine

Base system

Plugin

Page 116: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Plugins

AdvantagesExtensibility

Application can get new functionalities in some ways that were not foreseen by the original developers

CustomizationApplication can have a

small kernel that is extended on demand

ChallengesConsistency

Plugins must be added to the system in a sound way

PerformanceDelay

searching/configuring plugins

SecurityPlugins made by third

parties can compromise security

Plugin management and dependencies

Page 117: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Plugins

Examples

Eclipse

Firefox

Technologies

Component systems: OSGi

Page 118: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Microkernel

Identify minimal functionality in a microkernel

Extra functionality is added using internal servers

External server handles communication with other

systems

MicrokernelAdapter

ServidorinternoServidor

internoInternalserver

Externalserver

Client

System

Page 119: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Microkernel

Elements

Microkernel: Minimal functionality

Internal server: Extra functionality

External server: Offers external API

Client: External application

Adapter: Component that establish communication

with external server

MicrokernelAdapter

ServidorinternoServidor

internoInternalserver

Externalserver

Client

System

Page 120: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Microkernel

Constraints:

Microkernel implements only minimal functionality

The rest of the functionality is implemented using

internal servers

Communication with clients by external servers

MicrokernelAdapter

ServidorinternoServidor

internoInternalserver

Externalserver

Client

System

Page 121: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Microkernel

AdvantagesPortability

It is only needed to port the kernel

Flexibility and extensibilityAdding new functionality

with new internal serversSecurity and reliability

Critical parts of the system are encapsulated

Errors in external parts don't affect the microkernel

ChallengesPerformance

A monolithic can be more efficient

Design complexityIdentify components in the

microkernelIt may be difficult to separate

parts to internal servers

Unique point of failureIf microkernel fails, the

whole system may fail

Page 122: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Microkernel

Applications

Operating systems

Games

Editors

Page 123: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Reflection

It allows to change the structure and behavior of

an application dynamically

Systems that can modify themselves

Base level

Metalevel

Meta-objectProtocol

Page 124: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Reflection

Elements

Base level: Implements application logic

Metalevel: Aspects that can be modified

Metaobject protocol: Interface that can modify the

metalevel

Base level

Metalevel

Meta-objectProtocol

Page 125: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Reflection

Constraints

Base level uses metalevel aspects for its behavior

At runtime, it is possible to modify the metalevel

using the metaobject protocol

Base level

Metalevel

Meta-objectProtocol

Page 126: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Reflection

Advantages

Flexibility

Adapt to changing

conditions

Change behavior of

running system

without changing

source code or

stopping execution

ChallengesImplementation

Not all languages enable meta-programming

More difficult to combine with static type systems

PerformanceIt may be necessary to do

some optimizations to limit reflection

Security: Consistency maintenance

Page 127: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Reflection

Applications

Most dynamic languages support reflection

Scheme, CLOS, Ruby, Python, ....

Intelligent systems

Self-modifiable code

Base level

Metalevel

Meta-objectProtocol

Page 128: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Interpreters and DSLs

Include a domain specific language (DSL) that is

interpreted by the system

Context

InterpreterDSL

program

Application

User

Page 129: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Interpreters and DSLs

Elements

Interpreter: Module that executes the program

Program: Written in the DSL

DSL can be designed so the end user can write programs

Context: Environment where the program is executed

Contexto

IntérpretePrograma

en DSL

Aplicación

Usuario

Page 130: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Interpreters and DSLs

Constraints

Interpreter runs the program interacting with the

context

It is necessary to define a DSL

Syntax (grammar, parsing,...)

Semantics (behavior)

Contexto

IntérpretePrograma

en DSL

Aplicación

Usuario

Page 131: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Interpreters and DSLs

Advantages

Flexibility

Adapt application behavior

to user needs

Usability

End users can write their

own programs

Adaptability

Easy to adapt to

unforeseen situations

ChallengesDesign of the DSLComplexity of

implementationInterpreter

Separation of context/interpreter

PerformancePossible programs may be

not optimal

SecurityHandle wrong programs

Page 132: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Interpreters and DSLs

Variants:

Embedded DSLs

Page 133: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Embedded DSLs

Embedded DSLs

Domain specific languages that are embedded in

general purpose host languages

This technique is popular in soma languages like

Haskell, Ruby, Scala, etc.

Page 134: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Embedded DSLs

Advantages:

Reuse of host language syntax

Access to libraries and IDEs of host language

Challenges

Separation between DSL and host language

End users may have too many expressivity

Page 135: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile code

Code that is transferred from one machine to another

System A sends a program to be run by system B

System B must contain an interpreter for the language

in which the program is written

Network

SystemA

SystemB

Interpreter

program

Page 136: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile code

Elements

Interpreter: Runs the code

Program: Program that is transferred

Network: Transfers the program

Network

SystemA

SystemB

Interpreter

program

Page 137: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile code

Constraints

The program must be run in the receiver system

The network protocol transfers the program

Network

SystemA

SystemB

Interpreter

program

Page 138: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile code

Advantages

Flexibility and adaptability to new environments

Parallelism

Challenges

Complexity of implementation

Security

Network

SystemA

SystemB

Interpreter

program

Page 139: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile code

Variants

Code on demand

Remote evaluation

Mobile Agents

Page 140: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do

Network

Code on demand

Code is downloaded and run by the client

Combination between mobile code and client-

server

Example:

ECMAScript

Client

Program

ServerQuery

InterpreterAnswer

Page 141: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Code on demand

ElementsClient

Server

Code that is transferred from server to client

ConstraintsCode resides or is generated by the server

It is transferred to the client when it asks for it

It is run by the clientClient must have an interpreter for the corresponding

language

Page 142: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Code on demand

AdvantagesImproves user experience

Extensibility: Application can add new functionalities that were not foreseenNo need to install or

download a whole application

Always Beta

Adaptability to client environment

ChallengesSecurityCoherence

It may be difficult to ensure an homogeneous behavior in different types of clientsClient can even decide

not to run the programReminder: Responsive

design

Page 143: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Code on demand

Applications:

RIA (Rich Internet Applications)

HTML5 standardizes a lot of APIs

Improves coherence between clients

Variants

AJAX

Initially: Asynchronous Javascript and XML

The program that is running at the client side sends

asynchronous requests to the server without

stopping its running

Page 144: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Remote evaluation

System A sends program to system B to be run

and obtain its results

SystemA

SystemB

Answer(Result)

Interpreter

Program

Query

Network

Page 145: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Remote evaluation

Elements

Sender: Does the query including the program

Receiver: Runs the program and returns the results

Constraints

Receiver runs the program

It must contain some interpreter of the program

language or the program could be in machine code

Network protocol transfers program and results

Page 146: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Remote evaluation

Advantages

Exploits capabilities of third parties

Computational capabilities, memory, resources, etc.

Challenges

Security

Untrusted code

Virus = variant of this style

Configuration

Page 147: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Remote evaluation

Example:

Volunteer computation

SETI@HOME

It was the basis for the BOINC systemBerkeley Open Infrastructure for Network Computing

Other projects: Folding@HOME, Predictor@Home,

AQUA@HOME, etc.

Page 148: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile agents

Code and data can move from one machine to

another to be run

The process takes its state from machine to

machine

Code can move autonomously

System B

Program Interpreter

System A

Program Interpreter

Page 149: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile agents

Elements

Mobile agent: Program that travels and is run from

one machine or another autonomously

System: Execution environment where the mobile

agents are run

Network protocol: transfers state between agents

Systema B

Program Interpreter

System A

Program Interpreter

Page 150: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile agents

Constraints

Systems host and run mobile agents

Mobile agents can decide to change its running

from one system to another

They can communicate with other agents

Systema B

Program Interpreter

System A

Program Interpreter

Page 151: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile agents

AdvantagesIt can reduce network traffic

Code blocks that are run are transmitted

Implicit parallelismFault tolerance to network failuresAgents can be conceptually

simpleAgent = independent unit of

executionIt is possible to create mobile agent

systemsEmergent behaviour

Adaptability to environtmentchangesReactive and learning systems

Challenges

Complexity of configuration

Security

Malicious or incorrect code

Page 152: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile agents

Challenges

Complexity of configuration

Security

Malicious or incorrect code

Systema B

Program Interpreter

System A

Program Interpreter

Page 153: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do Mobile agents

Applications

Information retrieval

Web crawlers

Peer-to-peer systems

Telecommunications

Remote control and monitoring

Systems:

JADE (Java Agent DEvelopment framework)

IBM Aglets

Page 154: Presentación de PowerPoint · 2020. 6. 6. · o PAC Advantages Separation of concerns Identifies functionalities Support for changes and extensions It is possible to modify an agent

Software ArchitectureS

ch

oo

lo

f C

om

pu

ter

Sc

ien

ce

Un

ive

rsit

yo

f O

vie

do