Distributed System Lecture 2
Distributed System Lecture 2
Pan Hui
[email protected]
Huber Flores
[email protected]
Recap
• Fundamentals of distributed systems
– Concepts
– Models
ARCHITECTURES
Agenda
• Understanding different architecture
styles
• Mapping a system to a model
– State machine (Automaton)
Architecture
• Define the organization of a distributed system
– Interaction
– Behavior
• Software architecture
– Logical organization and interaction of software
components
• System architecture
– Instantiation of a software architecture on real
machines
Architecture styles
• The notion of an architectural style
– Formulated in terms of components, their connections and
the data exchanged between them
– A component is a modular unit with well-defined required
and provided interfaces, replaceable within its environment
– A connector is a mechanism mediating communication,
collaboration, coordination or cooperation among
components
Layered architectures
• Component at layer Li is
allowed to call component
at the underlying layer Li-1
but not the other way around
• Widely adopted in
networking
Layered architectures
• Layered networking architectures
Hybrid Internet protocol stack
Object-based architectures
• Objects correspond to
components
• Components are
connected via a
(remote) procedure
call mechanism
– RMI, RPC
– Web services
• REST, SOA
Resource-centered architectures
• Processes communicate through a common (passive
or active) resource, e.g., repository
• Examples
– Distributed file systems
– Web-based data services
Event-based architectures
• Processes communicate through propagation of events
• Events can optionally carry data
• Publish/subscribe systems
– Processes publish events
– Only processes having subscribed to particular events will
receive them
• Allows loose coupling
of processes
– Processes need not
explicitly refer to
each other
(referential decoupling)
System architectures
• Centralized architectures
• Decentralized architectures
System architectures
• Hybrid architectures
– Centralized and decentralized
Centralized architectures
• Client-server model
– Server (process) implements a specific service
– Client (process) request a service from a server by sending a request
and waiting for a reply
• Request-reply behavior
• Call semantics and transmission
failures
– Ideally: exactly-once
– Zero-or-more (“maybe”): service may or may have not been called
– At-least-once: keep requesting service until valid response arrives at
client
– At-most-once: no reply may mean that no execution took place
– Idempotent vs non-idempotent operations
Idempotent (repeatable) operation can be repeated multiple
times without harm
Helsinki, Finland, 2018.
17
Application layering
Application layering
• User-interface level
– Typically implemented by the client
– Consists of programs that allow end users to interact with applications
– Great variation in functionality provided by user interfaces
• Processing level
– Contains core functionality of an application
• Data level
– Contains programs that maintain the data on which the applications
operate
– Persistency
– Consistency
Multitiered architecture
• Simplest organization is to have only two types of machines
– A client machine containing only the programs implementing
(part of) the user-interface level
– A server machine containing the rest (programs implementing
the processing and data level)
Alternative two-tiered client-server organizations Fat clients ((d)-(e)) vs thin clients ((a)-(c))
Multitiered architecture
• Three-tiered architecture
– Single server is replaced by multiple servers running on
distributed machines
– Server sometimes acts as a client
• Vertical distribution
– Logically different components are placed on different machines
Helsinki, Finland, 2018.
21
Decentralized architectures
• Peer-to-peer systems
– Horizontal distribution (in contrast to vertical distribution)
– Processes are equal (functions need to be carried out are
represented by every process)
– Interaction between processes is symmetric (each process acts
as a client and a server at the same time ~ servent)
• Membership management
– Each node maintains shortcuts
to other nodes
– Joining: create random node id,
data items associated with id are
transferred from succ(id)
– Leaving: node id transfers its data
items to succ(id)
Mapping Splitting a
of data region when
items onto a node joins
nodes
Different ranking
functions can be used
Semantic
proximity
semantic overlay
networks
Superpeers
• Scalability problems with flat peer-to-peer structures
• Superpeer ~ special node maintaining an index of data
items or acting as a broker
– Long-lived processes with
high availability
• Hierarchical organization of
nodes into superpeer network
– Superpeers are often organized in
a peer-to-peer network
– Regular peer is connected as a client
to a superpeer (fixed relationship)
• Flexible means for nodes to join and leave the network
• Leader-election problem: how to select the nodes eligible
to become superpeers?
Helsinki, Finland, 2018.
30
Hybrid architectures
• Client-server solutions are combined with decentralized
architectures
• Edge-server systems
– Clients connect to Internet via edge servers
– Motivation: reduced response times, load balancing, scalability
– E.g. web proxy (content-blind vs content-aware cache),
CDN (content distribution network) server
Hybrid architectures
• Collaborative distributed systems (e.g., BitTorrent)
– File is divided into chunks stored in different nodes
– Global directory holds reference to .torrent metadata file
– Tracker keeps track of nodes having chunks of the file
Interceptors
• Break the normal flow of control and allow other (application
specific) code to be executed
• Request-level
interceptor
– E.g. make call for
each replica of
object B
• Message-level
interceptor
– E.g. assist in
transferring
invocation to
target object
SYSTEM MODELLING
Models
• Components of a system are processes
– Finite state machine
• Each process is depicted by a state
Your tasks
• For next lecture session:
– Read Chapter 3 Processes (From Van Steen)
– Code migration
• Flores, Huber, Pan Hui, Sasu Tarkoma, Yong Li, Satish Srirama, and Rajkumar Buyya.
"Mobile code offloading: from concept to practice and beyond." IEEE
Communications Magazine 53, no. 3 (2015): 80-88.
– Hybrid systems
• Flores, Huber, Rajesh Sharma, Denzil Ferreira, Vassilis Kostakos, Jukka Manner, Sasu
Tarkoma, Pan Hui, and Yong Li. "Social-aware hybrid mobile offloading." Pervasive
and Mobile Computing 36 (2017): 25-43.
QUESTIONS