distributed systems comp 212 - university of liverpoolmichailo/teaching/comp212/lecture14.pdf ·...

31
Distributed Systems COMP 212 Lecture 14 Othon Michail

Upload: lamkhue

Post on 16-Mar-2018

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

Distributed SystemsCOMP 212

Lecture 14

Othon Michail

Page 2: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

2/31

Architectures & Processes

Page 3: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

3/31

Client-Server Model

Page 4: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

4/31

Clients and Servers

Processes are divided into

• Servers: implementing a specific service

– e.g., file system, database

• Clients: requesting a service from a server by sending it a request and subsequent waiting for the server’s reply

• Distributed across different machines

• Follow a request-reply behaviour

Page 5: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

5/31

What’s a Server?

Definition: “A process that implements a specific service on behalf of a collection of clients”.

Typically, servers are organised to do one of two things:

1. Wait

2. Service

• … wait … service … wait … service … wait …

Page 6: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

6/31

Servers: Iterative and Concurrent

• Iterative: server handles request, then returns results to the client; any new client requests must wait for previous request to complete (also useful to think of this type of server as sequential).

• Concurrent: server does not handle the request itself; a separate thread or sub-process handles the request and returns any results to the client; the server is then free to immediately service the next client (i.e., there’s no waiting, as service requests are processed in parallel).

Page 7: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

7/31

Server “States”

• Stateless server – does not keep information on the state of its clients – Classic example: the web – This type of server is easy to implement

• Stateful server – generally maintains persistent information on its clients– Example: file server that allows clients to keep local copies of

files• Server must maintain (client, file) entries to keep track of the

distribution and access rights

– These are more difficult to implement– Improves performance but if e.g. crashes has to recover its

entire state just before the crash

• Cookies?

Page 8: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

8/31

Application Layering

• A three-layered (or level) view from database applications1. User-interface level

– All necessary to directly interface with the user– e.g., a webpage with forms– Clients typically implement this

2. Processing level– Contains the core functionality of the application

3. Data level– Contains the programs that maintain the actual data on which

the applications operate– Servers typically implement this– Data may be persistent (i.e., maintained even when no client is

operating on them)

Page 9: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

9/31

A Three-layered Example

• The general organisation of an Internet search engine

into three different layers

– Often referred to as tiers

Page 10: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

10/31

Two-tiered Architectures

Alternative client-server organisations in the two-tiered architecture

• 2 kinds of machines: clients and servers

Page 11: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

11/31

Two-tiered Architectures

• Client:

– Only terminal-dependent part of the user interface

• Give the applications remotecontrol over the presentation of their data

Page 12: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

12/31

Two-tiered Architectures

• Client:– Graphical front end

• Communicates with the rest of the application (at the server) throughan application-specific protocol

• Client software only proceses whatis necessary for presenting the interface

Page 13: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

13/31

Two-tiered Architectures

• Client:

– Has also part of the application

– e.g., filling in forms

– filled in, checked, interact with user

– Also word processors, where more advanced checking, e.g. grammar, may occur at the server

Page 14: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

14/31

Two-tiered Architectures

• Popular organisations

• Client:– PC or workstation

– Connected to a distributed file system or database

– Running most of the application

• Server:– Operations on files and

database entries

• e.g., banking applications

• (e) : e.g., caching at the client

Page 15: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

15/31

Multitiered Architectures

• There is a recent trend to move away from (d) and (e)• Most of the processing and data storage is moving to

the server• Thin clients of (a)-(c) instead of fat clients (d), (e)• Because:

– Client machines are difficult to manage

• Therefore, concentrate functionalities at servers– Is this distributed?– Yes: Servers themselves are becoming more and more

distributed; replaced by multiple servers running on different machines

• A server may sometimes need to also act as a client– Three-tiered architecture (and multitiered in general)

Page 16: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

16/31

Multitiered Architectures

Page 17: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

17/31

Cooperating Servers (1)

Multitiered system

Page 18: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

18/31

Cooperating Servers (2)

Proxy server

Page 19: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

19/31

Multitiered Architectures

• An example of a server acting as a client– This is a very common vertical distribution model for distributed

systems.

• An application: Web sites– Web server (entry point to site) ↔ Application Server (actual

processing) ↔ Database server (raw data)

Page 20: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

20/31

Vertical vs Horizontal Splitting

• Vertical distribution: placing logically different components on different machines

• Horizontal distribution: a client or server may be physically split up into logically equivalent parts, each operating on its own share of the complete data

– Examples: server farms/clusters, peer-to-peer systems

Page 21: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

21/31

An Example of a Modern Architecture

• An example of horizontal distribution of a Web service– Often also referred to as clustering

Page 22: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

22/31

More Like This

Page 23: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

23/31

Other Architectures

Page 24: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

24/31

Alternative Architectures

• Cooperating clients

– Teleconferencing

• Web applets

• Peer-to-peer networks

Page 25: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

25/31

Web Applets

Page 26: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

26/31

Peer-to-peer Networks

Page 27: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

27/31

Server Distributing a Large File

d1

d2

d3

d4

upload rate us

Download rates di

Internet

Page 28: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

28/31

Peers Help Distributing a Large File

d1

F bits

d2

d3

d4

upload rate us

Download rates di

Internet

u1u2

u3

u4

Upload rates ui

Page 29: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

29/31

Brief History of P2P

• 1999: Napster– Centralised inventory of available files

– Restricted to music files

– Out of business by mid 2000

• Many followed (with novel characteristics):– Truly decentralised P2P networks

– Decentralised catalogue

– Search by asking neighbours

– No control over distributed content

Page 30: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

30/31

Bit Torrent

• Developed in 2002 to speed up distribution of large files

• Control over what is being distributed – “trackers”

• Free software distributions

• Blizzard Downloader for WoW, Starcraft II

• Facebook, Twitter to update servers

• A file is split in small pieces

• Rarest pieces are distributed first (+random pieces)

• Faster uploaders get priority

• 30-50% of all traffic

Page 31: Distributed Systems COMP 212 - University of Liverpoolmichailo/teaching/comp212/Lecture14.pdf · – Contains the core functionality of the application 3. ... Vertical vs Horizontal

31/31

Conclusions

• Architecture of modern distributed systems can be rather involved

• Tiered servers

• Cooperating servers / clients

• Peer-to-peer

• Client-server communication is still the most popular form of communication