CSE 451: Operating Systems Winter Module 21 Web Servers / Services

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
RPC Robert Grimm New York University Remote Procedure Calls.
Remote Procedure Call Design issues Implementation RPC programming
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Distributed Systems Lecture #3: Remote Communication.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Communication in Distributed Systems –Part 2
Remote Procedure Calls. 2 Client/Server Paradigm Common model for structuring distributed computations A server is a program (or collection of programs)
.NET Mobile Application Development Remote Procedure Call.
4/25/ Application Server Issues for the Project CSEP 545 Transaction Processing for E-Commerce Philip A. Bernstein Copyright ©2003 Philip A. Bernstein.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Remote Procedure CallCS-502 Fall Remote Procedure Call CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System Concepts,
Remote Procedure Call Andrew Whitaker CSE451. Remote Procedure Call RPC exposes a programming interface across machines: interface PriceService { Price.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Lecture 15 Introduction to Web Services Web Service Applications.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
CS 153 Design of Operating Systems Spring 2015 Lecture 23: Inter-Process Communication (IPC) and Remote Procedure Call (RPC)
 Remote Procedure Call (RPC) is a high-level model for client-sever communication.  It provides the programmers with a familiar mechanism for building.
IT 344: Operating Systems Winter 2008 Module 19 Networking & Remote Procedure Call (RPC) Chia-Chi Teng CTB 265.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Page 1 Remote Procedure Calls Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Java Programming: Advanced Topics 1 Networking Programming Chapter 11.
Remote Procedure CallCS-502 Fall Remote Procedure Call (continued) CS-502, Operating Systems Fall 2007 (Slides include materials from Operating System.
Remote Procedure Call RPC
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Web Services An Introduction Copyright © Curt Hill.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
© Oxford University Press 2011 DISTRIBUTED COMPUTING Sunita Mahajan Sunita Mahajan, Principal, Institute of Computer Science, MET League of Colleges, Mumbai.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Topic 3: Remote Invocation Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
What’s Really Happening
6. Application Server Issues for the Project
Tiny http client and server
Block 5: An application layer protocol: HTTP
WWW and HTTP King Fahd University of Petroleum & Minerals
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
WEB SERVICES From Chapter 19 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
CSE 486/586 Distributed Systems Remote Procedure Call
What is RMI? Remote Method Invocation
Web Caching? Web Caching:.
Programming Models for Distributed Application
Remote Procedure Call present by :Enas Alkhoshi
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
DISTRIBUTED COMPUTING
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Remote Procedure Call Hank Levy 1.
CS-502, Operating Systems Fall 2009 (EMC)
Chapter 15: File System Internals
WEB SERVICES From Chapter 19, Distributed Systems
Distributed Systems CS
Remote invocation (call)
Remote Procedure Call Hank Levy 1.
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Remote Procedure Call Hank Levy 1.
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Distributed Systems CS
Presentation transcript:

CSE 451: Operating Systems Winter 2006 Module 21 Web Servers / Services John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1

Web Browsers / Servers: Intro 128.208.4.202 128.208.2.93 (peshastin.cs.washington.edu) 199.239.137.245 (www.nytimes.com) Fetching http://www.nytimes.com/index.html 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan DNS A distributed, hierarchically structured service 13 logical “root servers”; some are backed by multiple physical servers Names are resolved from right to left: www.nytimes.com Root servers know about the rightmost names (com, org, edu, net, etc.) They redirect the client to look at the server for “com”, which redirects to the “nytimes” server, which sends back the address for “www” Caching is used extensively to limit traffic to root (and all) servers Most root server traffic is for mis-typed names 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Web Servers In the simplest case, the URL path is used to locate a file The web server is configured with so that www.nytimes.edu corresponds to a particular directory in the machine’s file system The rest of the URL path is then traversed in the file system The file arrived at this way is returned Things are actually more complex, of course. The web server actually implements a generalization of symbolic links – rules that cause URL paths to be rewritten as they are transformed into file system paths The web server also implements its own security system, independently of that implemented by the file system Why? 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan cgi’s Quite soon after the web became popular, people found they needed “dynamic content” – pages whose content was created programmatically at the time of the request E.g., amazon.com No problem – the Web server has rules that indicate which URLs actually name programs When one of these URLs is received, the program is run, and its output is returned to the client (browser) Some (many!) web requests are therefore actually “calls” that execute remote code 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Revisiting the Original Scenario: I User  Browser http://www.nytimes.com/index.html Browser  128.208.4.202 : 53 “query www.nytimes.com” DNS Server  Browser 199.239.137.245 Browser  199.239.137.245 : 80 GET /index.html HTTP/1.1 Host: www.nytimes.com 199.239.137.245  Browser HTTP/1.1 200 OK Server: Sun-ONE-Web-Server/6.1 Date: Fri, 02 Jun 2006 06:59:52 GMT Content-type: text/html Cache-control: no-cache Pragma: no-cache <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>The New York Times - Breaking News, World News & Multimedia</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> Browser Formats and displays page 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Revisiting the Original Scenario: II client URL browser Resolve host dns server IP address fetch page web server return page display page We’ve seen this kind of control flow before… It’s procedure call! Unfortunately, we’re going over a network, so… 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

The Old Fashioned (Current?) Method Apache Firefox Server process starts Server process creates socket and listens for connection Client process starts Client process creates socket and binds it to server socket Server (thread) accepts connection Client formats a message and writes it to socket Server reads from socket, parses messages, executes, formats a reply, and writes it to socket Client parses reply What about this seems wrong? 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

Remote Procedure Call (RPC) Use procedure calls as the model for distributed (remote) communication have servers export a set of procedures that can be called by client programs similar to library API, class definitions, etc. clients do a local procedure call, as though they were directly linked with the server under the covers, the procedure call is converted into a message exchange with the server largely invisible to the programmer! Interfaces are type checked; data is automatically packed into messages at sender and unpacked at receiver 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC issues There are a bunch of hard issues: how do we make the “remote” part of RPC invisible to the programmer? and is that a good idea? what are the semantics of parameter passing? what if we try to pass by reference? how do we bind (locate/connect-to) servers? how do we handle heterogeneity? OS, language, architecture, … how do we make it go fast? 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

RPC example invocation Client Program: … sum = server->Add(3,4); Server Program: int Add(int x, int y) { return x + y; } Topics: interface description stubs stub generation parameter marshalling binding runtime system error handling performance thread pools client-side stub: int Add(int x, int y) { alloc message buffer; mark as “add” call; store x,y in buffer; send message; receive response; unpack response; return response; } server-side stub: Message Add_Stub(Message m) { remove x,y from m; r = Add(x,y); allocate response buffer; store r in response; return response; } RPC runtime system: send message to server; receive response; RPC runtime system: receive message m; response = Add_Stub(m); send response to client; 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC model A server defines the service interface using an interface definition language (IDL) the IDL specifies the names, parameters, and types for all client-callable server procedures example: ASN.1 in the OSI reference model example: Sun’s XDR (external data representation) A “stub compiler” reads the IDL declarations and produces two stub procedures for each server procedure the server programmer implements the service’s procedures and links them with the server-side stubs the client programmer implements the client program and links it with the client-side stubs the stubs manage all of the details of remote communication between client and server using the RPC runtime system 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC stubs A client-side stub is a procedure that looks to the client as if it were a callable server procedure it has the same API as the server’s implementation of the procedure a client-side stub is just called a “stub” in Java RMI A server-side stub looks like a caller to the server it looks like a hunk of code that invokes the server procedure a server-side stub is called a “skeleton” or “skel” in Java RMI The client program thinks it’s invoking the server but it’s calling into the client-side stub The server program thinks it’s called by the client but it’s really called by the server-side stub The stubs send messages to each other, via the runtime, to make the RPC happen transparently 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC marshalling Marshalling is the packing of procedure parameters into a message packet the RPC stubs call type-specific procedure to marshal or unmarshal the parameters of an RPC the client stub marshals the parameters into a message the server stub unmarshals the parameters and uses them to invoke the service’s procedure on return: the server stub marshals the return value the client stub unmarshals the return value, and returns them to the client program 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC binding Binding is the process of connecting the client to the server the server, when it starts up, exports its interface identifies itself to a network name server tells RPC runtime that it is alive and ready to accept calls the client, before issuing any calls, imports the server RPC runtime uses the name server to find the location of the server and establish a connection The import and export operations are explicit in the server and client programs a slight breakdown in transparency more to come… 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC transparency One goal of RPC is to be as transparent as possible make remote procedure calls look like local procedure calls we’ve seen that binding breaks this transparency What else breaks transparency? failures: remote nodes/networks can fail in more ways than with local procedure calls network partition, server crash need extra support to handle failures server can fail independently from client “partial failure”: a big issue in distributed systems if an RPC fails, was it invoked on the server? performance: remote communication is inherently slower than local communication if you’re not aware you’re doing a remote procedure call, your program might slow down an awful lot… 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan RPC and thread pools What happens if two client threads (or client programs) simultaneously invoke the same server procedure using RPC? ideally, two separate threads will run on the server so, the RPC run-time system on the server needs to spawn or dispatch threads into server-side stubs when messages arrive is there a limit on the number of threads? if so, does this change semantics? if not, what if 1,000,000 clients simultaneously RPC into the same server? 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Web Services RPC accessible remote code execution Some specific RPC system is used to access them (e.g., Java RMI/Jini, SOAP, CORBA) Example: Google Web Services Web search search() [like the online search, but with more options] cache() [returns page contents last time it was visited] Spell() [did you mean…?] Google earth … 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan

© 2006 Gribble, Lazowska, Levy, Zahorjan Web Services (cont.) Example: Amazon E-commerce interfaces (item lookup, cart management, etc.) Alexa (web crawling, structure, traffic, etc. measurements) S3 (network storage: $.15/GB/month + $.20/GB transferred) Historical pricing (pricing and sales information since 2002) Mechanical Turk (remote AI, $.005/HIT (Human Intelligence Task)) read (photo); photoContainsHuman = callMechanicalTurk(photo); if (photoContainsHuman == TRUE){     acceptPhoto; } else {     rejectPhoto; } How do they do this? 5/4/2019 © 2006 Gribble, Lazowska, Levy, Zahorjan