CS603: Distributed Systems Lecture 2: Client-Server Architecture, - - PowerPoint PPT Presentation

cs603 distributed systems
SMART_READER_LITE
LIVE PREVIEW

CS603: Distributed Systems Lecture 2: Client-Server Architecture, - - PowerPoint PPT Presentation

CS603: Distributed Systems Lecture 2: Client-Server Architecture, RPC, Corba Cristina Nita-Rotaru Lecture 2/ Spring 2006 1 ATC Architecture NETWORK INFRASTRUCTURE NETWORK INFRASTRUCTURE DATABASE DATABASE HOW WOULD YOU START BUILDING SUCH


slide-1
SLIDE 1

Cristina Nita-Rotaru Lecture 2/ Spring 2006 1

CS603: Distributed Systems

Lecture 2: Client-Server Architecture, RPC, Corba

slide-2
SLIDE 2

Cristina Nita-Rotaru Lecture 2/ Spring 2006 2

ATC Architecture

NETWORK INFRASTRUCTURE NETWORK INFRASTRUCTURE

DATABASE DATABASE

HOW WOULD YOU START BUILDING SUCH A SYSTEM?

slide-3
SLIDE 3

Cristina Nita-Rotaru Lecture 2/ Spring 2006 3

Outline

l Technologies/Protocols used in

Designing Distributed Systems

ß Client/Server ß RPC ß Corba ß J2EE ß .NET ß Web Services

slide-4
SLIDE 4

Cristina Nita-Rotaru Lecture 2/ Spring 2006 4

Client/Server Architecture

l Functionality is partitioned in a set of services

provided by a set of servers

l Clients (applications) interact with each

through the servers

l Examples:

ß File servers ß Database servers ß Network name servers ß Network time servers ß Mail servers ß Web servers

slide-5
SLIDE 5

Cristina Nita-Rotaru Lecture 2/ Spring 2006 5

Example: Group Communication Systems

l

Reliable and ordered message delivery

l

Group membership service (list with connected members)

Group A Group B

Client Server

Clients do not connect with each other, they communicate using the GCS servers

slide-6
SLIDE 6

Cristina Nita-Rotaru Lecture 2/ Spring 2006 6

Client/Server General Architecture

l Client must ‘bind’ to

a server

l Standard services

run on well-known ports

l Clients discover

services (directory

  • f servers providing

a desired service)

slide-7
SLIDE 7

Cristina Nita-Rotaru Lecture 2/ Spring 2006 7

Styles of Client/Server

l Stateless: server does not keep any information

between requests. There may be a shared state in the form of cache, but the correct function does not require the shared state to be accurate.

l Stateful: server remembers information between

  • requests. Client may take local actions based on

accuracy of information.

l Can you think about examples in each case?

slide-8
SLIDE 8

Cristina Nita-Rotaru Lecture 2/ Spring 2006 8

Remote Procedure Call (RPC)

Local function A … Remote function B A B

Provides support for programs to call a procedure

  • n a remote machine “just” as you would on the

local machine.(Birrell and Nelson 1985)

slide-9
SLIDE 9

Cristina Nita-Rotaru Lecture 2/ Spring 2006 9

client server “binds” to server prepares, sends request unpacks reply registers with name service receives request invokes handler sends reply

The basic RPC protocol

slide-10
SLIDE 10

Cristina Nita-Rotaru Lecture 2/ Spring 2006 10

RPC

l Provides a portable, high-level programming

interface, hides details as byte-ordering, alignment

l The remote procedure interface defines all

communication.

l Servers can be found with the help of

portmapper:

ß Server publish port, name and version with the portmapper daemon ß Client contacts the portmapper and asks where it can find the remote procedure, using name and version

  • ids. The portmapper daemon returns the address and

client and server communicate directly.

slide-11
SLIDE 11

Cristina Nita-Rotaru Lecture 2/ Spring 2006 11

RPC: What can go wrong?

l Network failure, client failure, server failure l Runs on UPD, reliability is achieved using

acknowledgments

ß If timeout with no ack, resend packet. ß May result in replayed requests.

l Detect duplicates: a sequence number and

timestamp embedded to enable detection of duplicates.

slide-12
SLIDE 12

Cristina Nita-Rotaru Lecture 2/ Spring 2006 12

RPC Optimization

l Delay sending acks, so

that imminent reply itself acts as an ack.

l Don’t send acks after each

packet.

l Send ack only at the end

  • f transmission of entire

RPC request.

l NACK sent when missing

sequence number detected

slide-13
SLIDE 13

Cristina Nita-Rotaru Lecture 2/ Spring 2006 13

What does a failed request mean?

l Client is waiting for acknowledgment that

does not come

l What does this mean: Network failure

(also long delay) and/or machine failure!

l How long should the client wait?

IF THE MACHINE FAILED, DID THE SERVER PROCESS THE REQUEST?????

slide-14
SLIDE 14

Cristina Nita-Rotaru Lecture 2/ Spring 2006 14

Example: Server Replication

l Provide a highly available service using two servers:

a primary and a backup

l The primary logs everything to the backup l If primary crashes, the backup soon catches up and

can take over

CLIENT CLIENT CLIENT CLIENT CLIENT BACKUP PRIMARY

slide-15
SLIDE 15

Cristina Nita-Rotaru Lecture 2/ Spring 2006 15

Normal case

l Everybody connected to the backup, no problems

CLIENT CLIENT CLIENT CLIENT CLIENT BACKUP PRIMARY

slide-16
SLIDE 16

Cristina Nita-Rotaru Lecture 2/ Spring 2006 16

Things go wrong…

CLIENT CLIENT CLIENT CLIENT CLIENT BACKUP PRIMARY Primary is down The backup Is down Primary is down Primary is down

slide-17
SLIDE 17

Cristina Nita-Rotaru Lecture 2/ Spring 2006 17

Things go very wrong…

CLIENT CLIENT CLIENT CLIENT CLIENT BACKUP PRIMARY I am the new Primary !!!! I am still the Primary Swich to backup Oops, no Service !

slide-18
SLIDE 18

Cristina Nita-Rotaru Lecture 2/ Spring 2006 18

SO WHAT?

Remember the ATC System: What if the system is used to answer the question “is anyone flying in such-and-such a sector of the sky”?????

slide-19
SLIDE 19

Cristina Nita-Rotaru Lecture 2/ Spring 2006 19

How to fix it???

Intuitively all participants should agree

  • n who is alive and who is not, should

agree on who is the primary

We will see later more details about this

slide-20
SLIDE 20

Cristina Nita-Rotaru Lecture 2/ Spring 2006 20

RPC on TCP

l TCP gives reliable communication when both

ends and the network connecting them are up.

l RPC protocol itself does not need to employ

timeouts and retransmission: less complex implementation.

l Broken connections reported by TCP mean the

same thing they did earlier (without TCP): Client still doesn’t know whether the server processed its request.

slide-21
SLIDE 21

Cristina Nita-Rotaru Lecture 2/ Spring 2006 21

RPC Semantics

l “Exactly Once”

ß Each request handled exactly once. ß Impossible to satisfy, in the face of failures. ÿ Can’t tell whether timeout was because of node failure

  • r communication failure

l “At most Once”

ß Each request handled at most once. ß Can be satisfied, assuming synchronized clocks, and using timestamps.

l “At least Once”

ß If client is active indefinitely, the request is eventually processed (maybe more than once)

slide-22
SLIDE 22

Cristina Nita-Rotaru Lecture 2/ Spring 2006 22

l RPC: remote procedure call l Lots of applications are object-oriented

How to provide support for distributed object oriented applications?

slide-23
SLIDE 23

Cristina Nita-Rotaru Lecture 3/ Spring 2006 2

What are Web Services?

l Software components that allows

applications (different programming languages and different platforms) to exchange data over computer networks

l Communication is via SOAP (uses

HTTP)

l Web services can be described in a

standard way WSDL (uses XML) language

slide-24
SLIDE 24

Cristina Nita-Rotaru Lecture 3/ Spring 2006 3

Benefits

l Software components that allows

applications (different programming languages and different platforms) to exchange data over computer networks

ß Portability, vendor, platform independence

slide-25
SLIDE 25

Cristina Nita-Rotaru Lecture 3/ Spring 2006 4

Benefits

l Communication is via SOAP (uses

HTTP)

ß Use of HTTP ensures that web services can work through many common firewall security measures without requiring changes to their filtering rules.

slide-26
SLIDE 26

Cristina Nita-Rotaru Lecture 3/ Spring 2006 8

Web Services: Details

l Service must be published l Client must

ß Discover the service ß Bind to the server

ß Pack the request (marshaling) and send the SOAP request

l Server must

ß Unpack the request (demarshaling), handles it, computes result. ß Sends answer back in the reverse direction: from the server to the SOAP router back to the client.

l Communication goes through the SOAP router

slide-27
SLIDE 27

Cristina Nita-Rotaru Lecture 3/ Spring 2006 9

SOAP

l a cleansing agent made from the

salts of vegetable or animal fats OOOPs! Wrong definition :)

l Simple Object Access Protocol SOAP : lightweight

XML-based protocol for exchange of information in a decentralized, distributed environment:

ß an envelope that defines a framework for describing what is in a message and how to process it ß a set of encoding rules for expressing instances of application-defined datatypes ß a convention for representing remote procedure calls and responses

slide-28
SLIDE 28

Cristina Nita-Rotaru Lecture 3/ Spring 2006 17

Where Web Services Fail Short

l Allow the data center to control decisions the

client makes

l Provide assistance in implementing naming

and discovery in scalable cluster-style services

ß How to load balance? How to replicate data? What precisely happens if a node crashes or one is launched while the service is up? ß Help with dynamics. For example, best server for a given client can be a function of load but also affinity, recent tasks, etc

slide-29
SLIDE 29

Cristina Nita-Rotaru Lecture 3/ Spring 2006 24

How Web Services Deal with Failures

l Failures of

ß naming service ß backend servers ß clients

l As other technologies, Web services suffers

from:

ß can not distinguish between crash failures and transient failures (crash vs. latency) ß when the service reports an error client does not know details about what happened

slide-30
SLIDE 30

Cristina Nita-Rotaru Lecture 3/ Spring 2006 25

Web Service Applications

l Grid Computing: Distributed computing l Involves coordinating and sharing computing,

application, data, storage, or network resources across dynamic and geographically dispersed

  • rganizations.

l Research challenges: scalability, security, system

management

l Computing power and storage increase, network

remains the bottleneck

slide-31
SLIDE 31

Cristina Nita-Rotaru Lecture 3/ Spring 2006 26

Future? Autonomic Computing

l Targets large-scale computer systems l Computers must learn to manage themselves, in

accordance with high-level guidance from humans.

l Self-monitoring, self-configuration, self-optimization,

self-healing, and/or self-protection.

l Specific self-managing components, such as server,

client, database, storage, or network elements. Emphasis should be placed on interactions with

  • ther components, or techniques or lessons that may

generalize to other components.

l http://www.autonomic-conference.org/

slide-32
SLIDE 32

Cristina Nita-Rotaru Lecture 3/ Spring 2006 28

Next …

l We will look at fundamental concepts in

distributed systems:

ß Time ß Consistency ß Detecting failures ß Membership