0% found this document useful (0 votes)
20 views21 pages

Chapter02 - Part 01

Uploaded by

socialdanish1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views21 pages

Chapter02 - Part 01

Uploaded by

socialdanish1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Distributed Systems

(4th edition, version 01)

Chapter 02: Architectures


Architectures Architectural styles

Architectural styles
Basic idea
A style is formulated in terms of
• (replaceable) components with well-defined interfaces
• the way that components are connected to each other
• the data exchanged between components
• how these components and connectors are jointly configured into a
system.

Connector
A mechanism that mediates communication, coordination, or cooperation
among components. Example: facilities for (remote) procedure call,
messaging, or streaming.
Architectures Architectural styles

Layered architecture
Different layered organizations

(a) (b) (c)

Layered architectures
Architectures Architectural styles

Example: communication protocols


Protocol, service, interface

Layered architectures
Architectures Architectural styles

Two-party communication
Server
1 from sock et import *
2
3 s = socket(AF_INET, SOCK_STREAM)
4 (co nn, ad d r) = s . a c c e p t ( ) # re t u r n s new s o c k e t and addr. c l i e n t
5 while True: # fo rever
6 d a t a = conn.recv(1024) # r e cei ve data from c l i e n t
7 i f not d a t a : break # s t o p i f c l i e n t stopped
8 msg = data.decode()+" * " # process t h e incoming d ata i n t o a response
9 conn.send(msg.encode()) # r e t u r n t h e response
10 conn.close() # c l o s e t h e connection

Client
1 from sock et import *
2
3 s = socket(AF_INET, SOCK_STREAM)
4 s.connect((HOST, PORT)) # connect t o s e r v e r (blo ck u n t i l accepted)
5 msg = "Hello World" # compose a message
6 s.send(msg.encode()) # send t h e message
7 d a t a = s.recv(1024) # r ec ei ve t h e response
8 print(data.decode()) # print the result
9 s.close() # c l o s e t h e connection

Layered architectures
Architectures Architectural styles

Application Layering
Traditional three-layered view
• Application-interface layer contains units for interfacing to users or
external applications
• Processing layer contains the functions of an application, i.e., without
specific data
• Data layer contains the data that a client wants to manipulate through the
application components

Layered architectures
Architectures Architectural styles

Application Layering
Traditional three-layered view
• Application-interface layer contains units for interfacing to users or
external applications
• Processing layer contains the functions of an application, i.e., without
specific data
• Data layer contains the data that a client wants to manipulate through the
application components

Observation
This layering is found in many distributed information systems, using traditional
database technology and accompanying applications.

Layered architectures
Architectures Architectural styles

Application Layering
Example: a simple search engine

Layered architectures
Architectures Architectural styles

Object-based style
Essence
Components are objects, connected to each other through procedure calls.
Objects may be placed on different machines; calls can thus execute across a
network.

Encapsulation
Objects are said to encapsulate data and offer methods on that data without
revealing the internal implementation.

Service-oriented architectures
Architectures Architectural styles

Object-based style
Common organization of a remote object with client-side proxy

Service-oriented architectures
Architectures Architectural styles

RESTful architectures
Essence
View a distributed system as a collection of resources, individually managed by
components. Resources may be added, removed, retrieved, and modified by
(remote) applications.
1. Resources are identified through a single naming scheme
2. All services offer the same interface i.e. the 4 basic operations
3. Messages sent to or from a service are fully self-described
4. After executing an operation at a service, that component forgets
everything about the caller i.e. stateless execution.

Basic operations
Operation Description
POST Create a new resource
GET Retrieve the state of a resource in some representation
DELETE Delete a resource
PUT Modify a resource by transferring a new state

Service-oriented architectures
Architectures Architectural styles

Example: Amazon’s Simple Storage Service


Essence
Objects (i.e., files) are placed into buckets (i.e., directories). Buckets cannot be
placed into buckets. Operations on ObjectName in bucket BucketName
require the following identifier:

http://BucketName.s3.amazonaws.com/ObjectName

Typical operations
All operations are carried out by sending HTTP requests:
• Create a bucket/object: PUT, along with the URI
• Listing objects: GET on a bucket name
• Reading an object: GET on a full URI

Service-oriented architectures
Architectures Architectural styles

On interfaces
Issue
Many people like RESTful approaches because the interface to a service is so
simple. The catch is that much needs to be done in the parameter space.

Amazon S3 SOAP interface

Service-oriented architectures
Architectures Architectural styles

On interfaces
Simplifications
Assume an interface bucket offering an operation create , requiring an input
string such as mybucket, for creating a bucket “mybucket.”

Service-oriented architectures
Architectures Architectural styles

On interfaces
Simplifications
Assume an interface bucket offering an operation create , requiring an input
string such as mybucket, for creating a bucket “mybucket.”

SOAP
import bucket
bucket.create("mybucket")

Service-oriented architectures
Architectures Architectural styles

On interfaces
Simplifications
Assume an interface bucket offering an operation create , requiring an input
string such as mybucket, for creating a bucket “mybucket.”

SOAP
import bucket
bucket.create("mybucket")

RESTful
PUT "https://mybucket.s3.amazonsws.com/"

Service-oriented architectures
Architectures Architectural styles

On interfaces
Simplifications
Assume an interface bucket offering an operation create , requiring an input
string such as mybucket, for creating a bucket “mybucket.”

SOAP
import bucket
bucket.create("mybucket")

RESTful
PUT "https://mybucket.s3.amazonsws.com/"

Conclusions
Are there any to draw?

Service-oriented architectures
Architectures Architectural styles

Coordination
Temporal and referential coupling
Temporally coupled Temporally decoupled
Referentially coupled Direct Mailbox
Referentially decoupled Event-based Shared data space

Event-based and Shared data space

Publish-subscribe architectures
Architectures Architectural styles

Example: Linda tuple space


Three simple operations
• i n ( t ) : remove a tuple matching template t
• r d ( t ) : obtain copy of a tuple matching template t
• o u t ( t ) : add tuple t to the tuple space

More details
• Calling o u t ( t ) twice in a row, leads to storing two copies of tuple t a
tuple space is modeled as a multiset.
• Both i n and r d are blocking operations: the caller will be blocked until a
matching tuple is found, or has become available.

Publish-subscribe architectures
Architectures Architectural styles

Example: Linda tuple space


1 import l i n d a
2 lin da.connect()
3
4 blog = linda.TupleSpace()
5 linda.universe._out(("MicroBlog",blog))
Bob: 6
7 blog = linda.universe._rd(("MicroBlog",linda.TupleSpace))[1]
8
9 blo g._ o ut(("bo b ","distsys","I am studying chap 2 " ))
10 blog._out(("bob","distsys","The l i n d a example’s p r e t t y simple"))
11 blog._out(("bob","gtcn","Cool book!"))
1 import l i n d a
2 lin da.connect()
3
Alice: 4 blog = linda.universe._rd(("MicroBlog",linda.TupleSpace))[1]
5
6 b lo g._ o ut(("alice","g t cn" ,"T h is graph th eo ry s t u f f i s n o t easy"))
7 b l o g . _ o u t ( ( " a l i c e " , " d i s t s y s " , " I l i k e systems more t h a n graphs"))
1 import l i n d a
2 lin da.connect()
3
4 blog = linda.universe._rd(("MicroBlog",linda.TupleSpace))[1]
5
Chuck: 6 t 1 = blog._rd(("bob","distsys",str))
7 t 2 = blog ._ rd (("alice","g t cn",s tr ))
8 t 3 = blog._rd(("bob","gtcn",str))
9
10 print t 1
11 print t 2
12 print t 3
Publish-subscribe architectures
Architectures Architectural styles

Publish and subscribe


Issue: how to match events?
• Assume events are described by (attribute,value) pairs
• topic-based subscription: specify a “attribute = value” series
• content-based subscription: specify a “attribute range” series

Observation
Content-based subscriptions may easily have serious scalability problems
(why?)

Publish-subscribe architectures

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy