28
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5 DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN Chapter 2 ARCHITECTURES

Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

DISTRIBUTED SYSTEMS

Principles and ParadigmsSecond Edition

ANDREW S. TANENBAUM

MAARTEN VAN STEEN

Chapter 2

ARCHITECTURES

Page 2: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

• DS should be composed of Components and Connectors.

»

• How components and connectors are connected is called Arch style.

• Architectural styles (logical styles) of distributed systems: • Layered architectures

• Object-based architectures

• Resource-centered architectures

• Event-based architectures

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Architectural Styles (1)

Page 3: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Layered Architec Style

Page 4: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Communication Protocols Stacks

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 5: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Application Layering (1)

• 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

Page 6: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Application Layering (2)

Page 7: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

object-based architectural style

• Components are objects

• Connected to each other through procedure calls.

• Objects may be placed on different machines;

Page 8: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

RESTful architectures: 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

Resource Based Arch

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 9: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Example: Amazon’s Simple Storage Service

• 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

• 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

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 10: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Publish-Subscribe Arch

Page 11: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Middleware Organization

1) Wrappers: A wrapper or adapter offers an interface

acceptable to an application but is not acceptable to a

component because the component is old. The wrapper do

proper transformations

2) Interceptors: break the normal flow of control and allow other

code to be executed.

3) Middleware contains solutions that are good for most

applications ) you may want to adapt its behavior for specific

applications.

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 12: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Organizing wrappers

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 13: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Interceptors

Figure 2-15. Using interceptors to handle remote-object invocations.

Page 14: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

System Architectures

Important styles of hardware architecture for distributed systems:

1.Centralized architectures1. Basic client-server

2. Application layering

3. Multi-tiered architectures

2.Decentralized architectures1. Structured P2P

2. Unstructured P2P

3.Hybrid architectures1.Edge server

2.Collaborative distributed systems

Page 15: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Centralized Architectures

Figure 2-3. General interaction between a client and a server.

Page 16: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Multi-tiered centralized system architectures

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

The 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,

– the programs implementing the processing and

data level

Page 17: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Traditional two-tiered configurations

Figure 2-5. Alternative client-server organizations (a)–(e).

Page 18: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Three Tiered Architecture

Figure 2-6. An example of a server acting as client.

Page 19: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

• 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).

Decentralized organizations

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 20: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

4 dimensional hypercube

To build 5 dimentional hypercube, two sets of 4d hypercubes are

connected to each other and so on.

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Structured Peer-to-Peer: Hypercube

Page 21: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Structured Peer-to-Peer Architectures (1)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.

• m=128 or 160 bits

typically.

Page 22: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Unstructured Peer-to-Peer

Architectures (1)Each node maintains an ad hoc list of neighbors. The resulting overlay

resembles a random graph: an edge <u,v>i 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 (v) 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.

Page 23: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Flooding versus random walk

Assume N nodes and that each data item is replicated across r

randomly chosen nodes.

Page 24: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Summary of Results

• 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.

• As the networks becomes bigger, locating data item becomes

problematic.

• Solution is to use special nodes that have index to data items.

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 25: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Super-peers Networks

Figure 2-12. A hierarchical organization of nodes into a

superpeer network.

Page 26: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Skype’s principle operation: A

wants to contact B

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Page 27: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Hybrid Architecture: Edge-Server Systems

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Viewing the Internet as consisting of a

collection of edge servers.

Page 28: Chapter 2 ARCHITECTURES - uCozramzi.ucoz.com/DistributedSys/chap-02v3.pdf · • DS should be composed of Components ... Basic client-server 2. Application layering 3. Multi-tiered

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5

Hybrid Architecture: Collaborative Distributed Systems

Figure 2-14. The principal working of BitTorrent [adapted with

permission from Pouwelse et al. (2004)].