350 likes | 530 Views
Distributed systems: a n architectural view. Dumb Terminal. Dumb Terminal. Dumb Terminal. Dumb Terminal. Dumb Terminal. Dumb Terminal. Once upon a time…. The Mainframe. Fixed local connections Or modems. All of the work is done at the center. Mainframe. logic/data presentation.
E N D
Dumb Terminal Dumb Terminal Dumb Terminal Dumb Terminal Dumb Terminal Dumb Terminal Once upon a time… The Mainframe Fixed local connections Or modems All of the work is done at the center
Mainframe logic/data presentation User input/output Mainframe Terminal
Intelligent Terminal Intelligent Terminal Intelligent Terminal Intelligent Terminal Intelligent Terminal Intelligent Terminal Once upon a time… The Mainframe Some work os done on the periphery: the client-server paradigm
Client server Some logic/data + presentation Most logic/data Server Client • Enabled by: • the Personal Computer / Workstation • the Internet (TCP/IP)
Client server - evolution Three tier architecture The Controller The Model Data Storage Business Logic Presentation Logic The View
Client server - problems Part of the BUSINESS LOGIC is performed on the periphery: The new version nightmare…
The Web – Back to the old model! Web Server 1 Web Server 2 Thin client General purpose Web Server 3
Needed Conceps: TCP-IP protocol suite Port
HTTP Overview HTTP Requests An HTTP request consists of a request method, (“subprotocol” specification) a request URL, (location) header fields, (metadata) a body. (data) HTTP 1.1 defines the following request methods: • GET: Retrieves the resource identified by the request URL • HEAD: Returns the headers identified by the request URL • POST: Sends data of unlimited length to the Web server • PUT: Stores a resource under the request URL • DELETE: Removes the resource identified by the request URL • OPTIONS: Returns the HTTP methods the server supports • TRACE: Returns the header fields sent with the TRACE request HTTP 1.0 includes only the GET, HEAD, and POST methods. Although J2EE servers are required to support only HTTP 1.0, in practice many servers support HTTP 1.1.
HTTP Overview HTTP Responses An HTTP response contains a result code, header fields, and a body. The HTTP protocol expects the result code and all header fields to be returned before any body content. Some commonly used status codes include: • 100: Continue • 200: OK • 404: the requested resource is not available • 401: the request requires HTTP authentication • 500: an error occurred inside the HTTP server that prevented it from fulfilling the request • 503: the HTTP server is temporarily overloaded and unable to handle the request For detailed information on this protocol, see the Internet RFCs: HTTP/1.0 (RFC 1945), HTTP/1.1 (RFC 2616). (http://www.rfc-editor.org/rfc.html) See also http://en.wikipedia.org/wiki/Http
HTTPS Overview https is a URI scheme which is syntactically identical to the http: scheme normally used for accessing resources using HTTP. Using an https: URL indicates that HTTP is to be used, but with a different default port (443) and an additional encryption/authentication layer between HTTP and TCP. This system was developed by Netscape Communications Corporation to provide authentication and encrypted communication and is widely used on the World Wide Web for security-sensitive communication, such as payment transactions.
S-HTTP Overview Secure hypertext transfer protocol' (S-HTTP) is an alternative mechanism to the https URI scheme for encrypting web communications carried over HTTP. S-HTTP is defined in RFC 2660. Web browsers typically use HTTP to communicate with web servers, sending and receiving information without encrypting it. For sensitive transactions, such as Internet e-commerce or online access to financial accounts, the browser and server must encrypt this information. The https: URI scheme and S-HTTP were both defined in the mid 1990s to address this need. Netscape and Microsoft supported HTTPS rather than S-HTTP, leading to HTTPS becoming the de facto standard mechanism for securing web communications. S-HTTP is an alternative mechanism that is not widely used.
The primitive Web model • HTTPD • Browser • Get URL • Get HTML file File System • Send HTML • Render HTML
Browser Internet The primitive Web model HTTP Get File System httpd Client Server
A simple interactive Web model • HTTPD • Browser • CGI Process • Get URL with Params • Execute CGI(params) • Build HTML on the fly • Send HTML • Render HTML
Browser Internet httpd process A simple interactive Web model HTTP Get File System Cgi-bin Client Server
An evolved interactive Web model • HTTPD • Browser • CGI Process • DB • Get URL with Params • Execute CGI(params) • Run Sql query • Send query results • Build HTML on the fly • Send HTML • Render HTML
Browser Internet httpd process DB An evolved interactive Web model HTTP Get File System Cgi-bin Query SQL Data Client Server
SLOW! SLOW! Browser Internet httpd process DB The Bottlenecks HTTP Get File System Cgi-bin Query SQL Data Client Server
SLOW! Browser Internet httpd process DB The Bottleneck – part I HTTP Get File System Cgi-bin Query SQL Data Client Server
Smart browser Internet httpd process DB The solution: reduce net traffic by having a smarter client! HTTP Get File System Cgi-bin Query SQL Data Client Server How? Including code in HTML
Smart browser Enabling technologies • Scripting languages • Javascript • Vbscript • Perlscript • Python • … (must be HW-OS-Browser independent!) Interpreted: Source code travels • Programming languages • Java Compiled: Executable travels Client
SLOW! Browser Internet httpd process DB The Bottleneck – part II HTTP Get File System Cgi-bin Query SQL Data Client Server
Browser Internet DB Function The solution: integrate the service into the httpd process HTTP Get File System Query SQL httpd Data Client Server
Function Enabling technologies (depending on server implementation) • Multithreading • DLL • Servlets File System • Using… • Scripting languages • Programming languages httpd Server How? Including code in HTML
mixed client- and server-sidescripting <HTML> … <SCRIPT LANGUAGE=VBScript RUNAT=SERVER> …VBScript Commands… </SCRIPT> … <%VBScript Commands%> … <SCRIPT LANGUAGE=JavaScript> …JavaScript Commands… </SCRIPT> … </HTML> Code executed by the Server BEFORE the page is transferred over the Net ASP Syntax Code transferred to the client and interpreted by the Browser
httpd Internet +CGI Client 1 Client 3 Client 2 The state problem Data User 1 ? Data User 2 Data User 3 Server
httpd Internet +CGI Client 1 Client 3 Client 2 A typical solution Supported by Java & JavaScript Cookie Data User 1 Data User 2 Cookie Data User 3 Server Cookie
httpd Browser Internet process process Java applet A more radical solution Supported by Java HTTP Get Client Cgi-bin Startup Startup Socket connection Server
httpd Browser CORBA Internet process process Java applet Middle Tier An even more radical solution Supported by Java HTTP Get Client Cgi-bin Startup Startup Server
WAP - Cenni 9600 baud (*) Client (cellular phone) MicroBrowser Gateway WAP Request WDP + WTSL (Wireless Datagram Protocol) Wireless Transport Security Layer Page description: Wml (Wireless Markup Language, in XML) Hdml (HandhelD Markup Language, variante di HTML Server HTTP More info: www.wapforum.org (*) GPRS up to 56 Kbit/sec, UMTS up to 2 Mbit/sec (Universal Mobile Telecommunication System)
XML Enabled HTTP Server Stylesheet Server HTTP Server Document Server Client Get document XSLT Processor HTTP request XML document Get SS XSL stylesheet XML + XSL HTML document HTML document
Browser Internet The Proxy Proxy httpd Server Client