Distributed systems:Distributed systems:aan architectural viewn architectural view
Once upon a time…Once upon a time…
The
Mainframe
DumbTerminal
DumbTerminal
DumbTerminal
DumbTerminal
DumbTerminal
DumbTerminal
All of the work is done at the center
Fixed local connectionsOr modems
Mainframe
Mainframe Terminal
logic/datapresentation User input/output
Once upon a time…Once upon a time…
The
Mainframe
IntelligentTerminal
IntelligentTerminal
IntelligentTerminal
IntelligentTerminal
IntelligentTerminal
IntelligentTerminal
Some work os done on the periphery: the client-server paradigm
Client server
Server Client
Most logic/data Some logic/data + presentation
Enabled by:• the Personal Computer / Workstation• the Internet (TCP/IP)
Client server - evolution
Three tier architecture
DataStorage
BusinessLogic
PresentationLogic
The Model The Controller
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 2 Thin client
General purpose
Web Server 3
Web Server 1
The Web:The Web:aan architectural viewn architectural view
Needed Conceps:
TCP-IP protocol suite
Port
HTTP Overview HTTP RequestsAn 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 ResponsesAn 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.
•Browser
•Render HTML
•Get URL
•Send HTML
•Get HTML file
•HTTPD
FileSystem
The primitive Web modelThe primitive Web model
http
d
The primitive Web model
Inte
rnet
HTTP Get
Client
Browser
Server
File System
•Browser
•Render HTML
•Get URL with Params
•Send HTML
•Execute CGI(params)
•Build HTML on the fly
•HTTPD •CGI Process
A simple interactive Web modelA simple interactive Web model
http
d
A simple interactive Web model
Inte
rnet
HTTP Get
Cgi-bin
proc
ess
Client
Browser
Server
File System
•Browser
•Render HTML
•Get URL with Params
•Send HTML
•Execute CGI(params)
•Build HTML on the fly
•HTTPD •CGI Process •DB
•Run Sql query
•Send query results
An evolved interactive Web modelAn evolved interactive Web model
http
d
An evolved interactive Web model
Inte
rnet
HTTP Get
Cgi-bin Query SQL
proc
ess
DB
Data
Client
Browser
Server
File System
http
d
The Bottlenecks
Inte
rnet
HTTP Get
Cgi-bin Query SQL
proc
ess
DB
Data
Client
Browser SLOW!
SLOW!
Server
File System
http
d
The Bottleneck – part I
Inte
rnet
HTTP Get
Cgi-bin Query SQL
proc
ess
DB
Data
Client
Browser SLOW!
Server
File System
http
d
The solution:
Inte
rnet
HTTP Get
Cgi-bin Query SQL
proc
ess
DB
Data
Client
Smartbrowser
How? How? Including code in HTMLIncluding code in HTML
Server
File System
reduce net traffic by having a smarter client!
Programming languagesProgramming languages
• JavaJava
Enabling technologies
Client
Smartbrowser
Scripting languagesScripting languages• JavascriptJavascript• VbscriptVbscript• PerlscriptPerlscript• PythonPython• … …
Interpreted:
Source code travels
Compiled:
Executable travels
(must be
HW-OS-Browser
independent!)
http
d
The Bottleneck – part II
Inte
rnet
HTTP Get
Cgi-bin Query SQL
proc
ess
DB
Data
Client
BrowserSLOW!
Server
File System
http
d
The solution:
Inte
rnet
HTTP Get
Query SQL
Function
DB
Data
Client
Browser
Server
File System
integrate the service into the httpd process
Enabling technologies
• MultithreadingMultithreading• DLLDLL• ServletsServlets
Using…Using…
•Scripting languagesScripting languages•Programming languagesProgramming languages
Function
http
dServer
How? How? Including code in HTMLIncluding code in HTML
File System
(depending on server implementation)
mixed client- and server-side scripting
<HTML><HTML>……<SCRIPT LANGUAGE=VBScript RUNAT=SERVER><SCRIPT LANGUAGE=VBScript RUNAT=SERVER>……VBScript Commands…VBScript Commands…</SCRIPT></SCRIPT>……<%VBScript Commands%><%VBScript Commands%>……<SCRIPT LANGUAGE=JavaScript><SCRIPT LANGUAGE=JavaScript>……JavaScript Commands…JavaScript Commands…</SCRIPT></SCRIPT>……</HTML></HTML>
Code executed Code executed by the Server by the Server BEFORE the BEFORE the page is page is transferred transferred over the Netover the Net
Code transferred to the clientCode transferred to the clientand interpreted by the Browserand interpreted by the Browser
ASP SyntaxASP Syntax
The state problem
Inte
rnet
Client
1
Server
+CGI
http
d
Data User 1
Data User 2
Data User 3
Client
3
Client
2
??
A typical solution
Inte
rnet
Client
1
Server
+CGI
http
d
Data User 1
Data User 2
Data User 3
Client
3
Client
2
CookieCookie
CookieCookie
CookieCookie
Supported
by Java & JavaScript
http
d
A more radical solution
Inte
rnet
HTTP GetCgi-bin
proc
ess
Client
Browser
Server
Java
ap
plet proc
ess
Startup
Sta
rtup
Socket connection
Supported
by Java
http
d
An even more radical solution
Inte
rnet
HTTP GetCgi-bin
proc
ess
Client
Browser
Server
Java
ap
plet proc
ess
Startup
Sta
rtup
CORBAMiddle Tier
Supported
by Java
WAP - Cenni
Client Client (cellular phone)(cellular phone)MicroBrowserMicroBrowser
Gateway WAPGateway WAPRequest WDP + WTSL
(Wireless Datagram Protocol)Wireless Transport Security Layer
Server HTTPServer HTTPPage description:
Wml (Wireless Markup Language, in XML)Hdml (HandhelD Markup Language, variante di HTML
9600 baud (*)
(*) GPRS up to 56 Kbit/sec, UMTS up to 2 Mbit/sec (Universal Mobile Telecommunication System)
More info: www.wapforum.org
XML Enabled HTTP Server
Client Client DocumentDocument
Server Server HTTPHTTPServer Server
XSLTXSLTProcessor Processor
HTTP request
StylesheetStylesheetServer Server
Get document
XML document Get SS
XSL stylesheet
XML + XSL
HTML documentHTML
document
http
d
The Proxy
Inte
rnet
Client
Browser
Server
Proxy