DOC PREVIEW
Berkeley COMPSCI 162 - Lecture 22 Client­Server

This preview shows page 1-2-3-4-26-27-28-54-55-56-57 out of 57 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 57 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS162 Operating Systems and Systems Programming Lecture 22 Client-ServerDistributed Systems are Everywhere!Client-ServerMessage PassingMessage Passing DetailsFrom Message Passing to Remote Procedure CallExample: Local Procedure CallRemote Procedure CallRPC: Argument PassingRPC Information FlowExample: Remote Procedure CallClient and Server StubsEncodingParameter Specification and Stub GenerationService Discovery: RPC BindingExample of RPC BindingRPC Semantics in the Presence of FailuresClient is Unable to Locate ServerLost Request MessageLost Reply MessageServer CrashesClient CrashesClient Crashes: Possible SolutionsRPC Semantics: DiscussionAsynchronous RPC (1)Asynchronous RPC (2)Decisions in the Presence of FailuresTwo-Phase Commit DetailsTwo-Phase Commit ExampleTwo-Phase Commit Example (cont’d)Slide 31Slide 32Two-Phase Commit GotchasThe Web – History (I)The Web – History (II)The Web – History (III)The WebUniform Record Locator (URL)Hyper Text Transfer Protocol (HTTP)Big PictureHyper Text Transfer Protocol CommandsClient RequestServer ResponseHTTP/1.0 ExampleHTTP/1.0 PerformanceHTTP/1.0 Caching SupportHTTP/1.1 (1996)Persistent ConnectionsPipelined Requests/ResponsesCaching and Replication“Base-line”Reverse CachesForward ProxiesContent Distribution Networks (CDNs)Example: AkamaiSlide 57SummaryCS162Operating Systems andSystems ProgrammingLecture 22Client-ServerApril 18, 2011Ion Stoicahttp://inst.eecs.berkeley.edu/~cs162Lec 22.24/18 Ion Stoica CS162 ©UCB Spring 2011Distributed Systems are Everywhere!•We need (want?) to share physical devices (e.g., printers) and information (e.g., files)•Many applications are distributed in nature (e.g., ATM machines, airline reservations)•Many large problems can be solved by decomposing smaller problems that run in parallel (e.g., MapReduce, SETI@home)•Next three lectures: go over three distributed system models–Client-server–Peer-to-peer–Cloud(cluster) computingLec 22.34/18 Ion Stoica CS162 ©UCB Spring 2011Client-Server•One or more clients interacting with one or more servers providing a service, e.g.,–Web–E-mail, chat–Printer–Airline reservation–On-line shopping–Store/streaming video, audio, and/or photos–…•In this lecture–End-to-end message communication–Remote Procedure Calls–Two phase commit transactions–World Wide WebLec 22.44/18 Ion Stoica CS162 ©UCB Spring 2011Message Passing•Process A (e.g., client) sends a packet to process B (e.g., server)16.25.31.10128.15.11.12Proc. A(port 10)Proc. B(port 7)InternetLec 22.54/18 Ion Stoica CS162 ©UCB Spring 2011Message Passing Details16.25.31.10 128.15.11.12Proc. A(port 10)InternetProc. B(port 7)TransportNetworkDatalinkPhysicalProc. A(port 10)Proc. B(port 7)TransportNetworkDatalinkPhysicaldata16.25.31.10 128.15.11.12data 10 7data 10 716.25.31.10 128.15.11.12datadatadata10 710 7Internet16.25.31.10128.15.11.12Lec 22.64/18 Ion Stoica CS162 ©UCB Spring 2011From Message Passing to Remote Procedure Call•Raw messaging is a bit too low-level for programming•Another option: Remote Procedure Call (RPC)–Looks like a local procedure call on client–Translated automatically into a procedure call on remote machine (server)•Implementation:–Uses request/response message passing “under the covers”Lec 22.74/18 Ion Stoica CS162 ©UCB Spring 2011Example: Local Procedure Call...n = sum(4, 7);...sum(i, j)int i, j;{ return (i+j);}MachineProcessLec 22.84/18 Ion Stoica CS162 ©UCB Spring 2011Remote Procedure Call•Transparently invoke a procedure (services) implemented in a different address space either on the same machine or a different machine–Services can be run wherever it’s most appropriate–Access to local and remote services looks the same•Challenges:–Argument (parameter) passing, potentially across different architectures–Discover where the service is located–Handle failures transparentlyLec 22.94/18 Ion Stoica CS162 ©UCB Spring 2011RPC: Argument Passing•Client and server use “stubs” to glue pieces together–Client-side stub is responsible for “marshalling” arguments and “unmarshalling” the return values–Server-side stub is responsible for “unmarshalling” arguments and “marshalling” the return values•Marshalling involves (depending on system) converting values to a canonical form, serializing objects, copying arguments passed by reference, etc.–Needs to account for cross-language and cross-platform issues •Technique: compiler generated stubs–Input: interface definition language (IDL)»Contains, among other things, types of arguments/return–Output: stub code in the appropriate source languageLec 22.104/18 Ion Stoica CS162 ©UCB Spring 2011RPC Information FlowClient(caller)Server(callee)PacketHandlerPacketHandlercallreturnsendreceivesendreceivereturncallNetworkNetworkClientStubbundleargsbundleret valsunbundleret valsServerStubunbundleargsMachine AMachine BLec 22.114/18 Ion Stoica CS162 ©UCB Spring 2011Example: Remote Procedure Call...n = sum(4, 7);...sum(i, j)int i, j;{ return (i+j);}ClientProcesssum47messageOSServerProcesssum47messageOSStubsLec 22.124/18 Ion Stoica CS162 ©UCB Spring 2011Client and Server Stubs•Principle of RPC between a client and server program.Lec 22.134/18 Ion Stoica CS162 ©UCB Spring 2011Encoding•Server and client may encode arguments differently, e.g.,–Big-endian: store from most-to-least significant byte–Little-endian: store from least-to-most significant bytea)Original message on x86 (e.g., little endian)b)The message after receipt on the SPARC (e.g., big endian)c)The message after being inverted. (The little numbers in boxes indicate the address of each byte)Lec 22.144/18 Ion Stoica CS162 ©UCB Spring 2011Parameter Specification and Stub Generationa) A procedureb) The corresponding message.Lec 22.154/18 Ion Stoica CS162 ©UCB Spring 2011Service Discovery: RPC Binding•How does client know which machine to send RPC?–Need to translate name of remote service into network endpoint (e.g., host:port)–Binding: the process of converting a user-visible name into a network endpoint»Static: fixed at compile time»Dynamic: performed at runtime•Dynamic Binding–Most RPC systems use dynamic binding via name service–Why dynamic binding?»Access control: check who is permitted to access service»Fail-over: If server fails, use a different oneLec 22.164/18 Ion Stoica CS162 ©UCB Spring 2011Example of RPC Binding•Distributed Computing Environment (DCE)


View Full Document

Berkeley COMPSCI 162 - Lecture 22 Client­Server

Documents in this Course
Lecture 1

Lecture 1

12 pages

Nachos

Nachos

41 pages

Security

Security

39 pages

Load more
Download Lecture 22 Client­Server
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 22 Client­Server and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 22 Client­Server 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?