Slides.02 System Model
Slides.02 System Model
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
Layered architectures
Architectures Architectural styles
Layered architectures
Architectures Architectural styles
Two-party communication
Server
1 from socket import *
2
3 s = socket(AF_INET, SOCK_STREAM)
4 (conn, addr) = s . a c c e p t ( ) # re tur ns new s o c k e t and addr. c l i e n t
5 while True: # forever
6 d a t a = conn.recv(1024) # re c e iv e 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 data i n t o a response
9 conn.send(msg.encode()) # re tu r n t h e response
10 conn.close() # c l o s e t h e connection
Client
1 from socket import *
2
3 s = socket(AF_INET, SOCK_STREAM)
4 s.connect((HOST, PORT)) # connect t o s e r v e r (block 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) # re c e iv e t h e response
8 print(data.decode()) # p r i n t t h e re s u l t
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
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
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
Basic operations
Operation Description
PUT Create a new resource
GET Retrieve the state of a resource in some representation
DELETE Delete a resource
POST Modify a resource by transferring a new state
Service-oriented architectures
Architectures Architectural styles
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.
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.amazo
nsws.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.amazo
nsws.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
Publish-subscribe architectures
Architectures Architectural styles
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
Observation
Content-based subscriptions may easily have serious scalability
problems (why?)
Publish-subscribe architectures
Architectures Middleware and distributed systems
Solution
A wrapper or adapter offers an interface acceptable to a client application.
Its functions are transformed into those available at the component.
Middleware organization
Architectures Middleware and distributed systems
Organizing wrappers
Two solutions: 1-on-1 or through a broker
Middleware organization
Architectures Middleware and distributed systems
Middleware organization
Architectures Middleware and distributed systems
Middleware organization
Architectures Layered-system architectures
Multitiered Architectures
Architectures Layered-system architectures
Multitiered Architectures
Architectures Layered-system architectures
NFS architecture
Alternative organizations
Vertical distribution
Comes from dividing distributed applications into three logical layers,
and running the components from each layer on a different server
(machine).
Horizontal distribution
A client or server may be physically split up into logically equivalent parts,
but each part is operating on its own share of the complete data set.
Peer-to-peer architectures
Processes are all equal: the functions that need to be carried out are
represented by every process ⇒ each process will act as a client and a
server at the same time (i.e., acting as a servant).
Architectures Symmetrically distributed system architectures
Structured P2P
Essence
Make use of a semantic-free index: each data item is uniquely associated
with a key, in turn used as an index. Common practice: use a hash function
key(data item) = hash(data item’s value).
P2P system now responsible for storing (key,value) pairs.
Example: Chord
Principle
• Nodes are logically organized in a ring. Each node has an m-bit
identifier.
• Each data item is hashed to an m-bit key.
• Data item with key k is stored at node with smallest identifier id ≥ k
, called the successor of key k .
• The ring is extended with various shortcut links to other nodes.
Example: Chord
lookup(3)@9 : 28 → 1 →
Structured peer-to-peer systems
4
Architectures Symmetrically distributed system architectures
Unstructured P2P
Essence
Each node maintains an ad hoc list of neighbors. The resulting overlay
resembles a random graph: an edge ⟨u, v ⟩ exists only with a certain
probability P[⟨u, v ⟩].
Searching
• Flooding: issuing node u passes request for d to all neighbors.
Request is ignored when receiving node had seen it before. Otherwise,
v searches locally for d (recursively). May be limited by a Time-To-Live:
a maximum number of hops.
• Random walk: issuing node u passes request for d to randomly
chosen neighbor, v . If v does not have d , it forwards request to one of
its randomly chosen neighbors, and so on.
Random walk
P[k ] probability that item is found after k attempts:
r r
P[kN] = (1 − )kN−1 .
S (“search size”) is expected number of nodes that need to be
probed:
N N
r
r k −1
S = k∑=1 k · P[k ] = ∑
k =1 k · (1 − ) ≈ N/r for 1 ≪ r ≤
N N
N.
Comparison
• If r / N = 0.001, then S ≈ 1000
• With flooding and d = 10, k = 4, we contact 7290 nodes.
• Random walks are more communication efficient, but might take
longer before they find the result.
Super-peer networks
Essence
It is sometimes sensible to break the symmetry in pure peer-to-peer
networks:
• When searching in unstructured P2P systems, having index
servers improves performance
• Deciding where to store data can often be done more efficiently
through brokers.
Example: BitTorrent
Architectures Hybrid system architectures
Cloud computing
Cloud computing
Architectures Hybrid system architectures
Cloud computing
Make a distinction between four layers
• Hardware: Processors, routers, power and cooling systems.
Customers normally never get to see these.
• Infrastructure: Deploys virtualization techniques. Evolves around
allocating and managing virtual storage devices and virtual
servers.
• Platform: Provides higher-level abstractions for storage and such.
Example: Amazon S3 storage system offers an API for (locally
created) files to be organized and stored in so-called buckets.
• Application: Actual applications, such as office suites (text processors,
spreadsheet applications, presentation applications). Comparable to the
suite of apps shipped with OSes.
Cloud computing
Architectures Hybrid system architectures
Edge-server architecture
Essence
Systems deployed on the Internet where servers are placed at the edge of
the network: the boundary between enterprise networks and the actual
Internet.
Edge orchestration
Managing resources at the edge may be trickier than in the cloud
• Resource allocation: we need to guarantee the availability of
the resources required to perform a service.
• Service placement: we need to decide when and where to place
a service. This is notably relevant for mobile applications.
• Edge selection: we need to decide which edge infrastructure should be
used when a service needs to be offered. The closest one may not be
the best one.
Observation
There is still a lot of buzz about edge infrastructures and computing,
yet whether all that buzz makes any sense remains to be seen.
Blockchains
Principle working of a blockchain system
Blockchain architectures
Architectures Hybrid system architectures
Blockchains
Principle working of a blockchain system
Observations
• Blocks are organized into an unforgeable append-only chain
• Each block in the blockchain is immutable ⇒ massive replication
• The real snag lies in who is allowed to append a block to a chain
Blockchain architectures
Architectures Hybrid system architectures
Observation
A single entity decides on which validator can go ahead and append a
block. Does not fit the design goals of blockchains.
Blockchain architectures
Architectures Hybrid system architectures
Observation
• A selected, relatively small group of servers jointly reach consensus
on which validator can go ahead.
• None of these servers needs to be trusted, as long as roughly two-
thirds behave according to their specifications.
• In practice, only a few tens of servers can be accommodated.
Blockchain architectures
Architectures Hybrid system architectures
Observation
• Participants collectively engage in a leader election. Only the
elected leader is allowed to append a block of validated transactions.
• Large-scale, decentralized leader election that is fair, robust, secure,
and so on, is far from trivial.
Blockchain architectures