Top Banner
Web Architecture and Technologies Ambient intelligence Fulvio Corno Politecnico di Torino, 2015/2016
42

Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Jul 08, 2018

Download

Documents

ledung
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Web Architecture and TechnologiesAmbient intelligence

Fulvio Corno

Politecnico di Torino, 2015/2016

Page 2: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Goal

• Understanding Web technologies

– Adopted for User Interfaces

– Adopted for Distributed Application Integration

2013/2014 Ambient intelligence: technology and design 2

Page 3: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

WEB ARCHITECTURE OVERVIEWHISTORICAL EVOLUTION

Web Architecture and Technologies

2013/2014 Ambient intelligence: technology and design 3

http://www.evolutionoftheweb.com

Page 4: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

N-tier (N-level) architecture

• Each level/tier has a well defined role

• One or more servers implement each tier/layer

• Servers can share hardware

• Communication between tiers/levels through the network

2013/2014 Ambient intelligence: technology and design 4

Browser

Internet infrastructure

Web Server

Application Server

Database Server 3rd party services

Client

Page 5: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 5

Client

Server(s)Internet

• Historically, a web browser

• But also:• Mobile application• Desktop application• Other server

application

• Logical server: A process that runs on a host that relays information to a client upon the client sending it a request.

• Physical server : A host computer on a network that holds information (eg, Web sites) and responds to requests for information

Page 6: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Web server (logical)

• Manages the HTTP protocol (handles requests and provides responses)

– Receives client requests

– Reads static pages/contents from the filesystem

– Activates the application server for dynamic pages/content generation (server-side)

– Provides an file (HTML, or other) back to the client

• One HTTP connection for each request

• Multi-process, Multi-threaded or Process pool

2013/2014 Ambient intelligence: technology and design 6

Page 7: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Example

2013/2014 Ambient intelligence: technology and design 7

Client

Web server

Internet

URLhttp request

HTMLfiles

http responsedisplaypage

TCP/IP

path

browser server file system

HTML

send

Page 8: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Adopted standards

• URL (uniform resource locator) for finding web pages

• HTML (hyper text markup language) for writing web pages

• GIF (graphics interchange format), PNG (portable network graphics), JPEG, … for images

• HTTP (hyper text transfer protocol) for client-server interaction

• TCP/IP (transmission control protocol over internet protocol) for data transfer

2013/2014 Ambient intelligence: technology and design 8

Page 9: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

HTML in 5 minutes

2013/2014 Ambient intelligence: technology and design 9

http://www.w3schools.com/

Page 10: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

URL

2013/2014 Ambient intelligence: technology and design 10

http://elite.polito.it/courses/01prd-ami

DNS

130.192.5.26

TCP

Contact server

File system

URI Rewriting

HTML file contents

/srv/www/elite/courses/01prd-ami

RFC 2396http://www.w3.org/Addressing/

HTTP Request

Page 11: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

URI Basics

• http://www.sadev.co.za/users/1/contact

• http://www.sadev.co.za?user=1&action=contact

• http://rob:[email protected]:8044

• https://bbd.co.za/index.html#about

Scheme

Scheme

Scheme

Scheme

Hostname

Hostname

Hostname

Hostname

Query

Query

Query

Port

Fragment

Userinfo

2013/2014 Ambient intelligence: technology and design 11

Page 12: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

HTTP protocol

2013/2014 Ambient intelligence: technology and design 12

GET / HTTP/1.1Host: elite.polito.itUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateCookie: __utma=18858605.1512105954.1382561222.1428481384.1428499850.353;Connection: keep-alive

HTTP/1.0 200 OKCache-Control: no-store, no-cache, must-revalidate, Connection: Keep-AliveContent-Encoding: gzipContent-Type: text/html; charset=utf-8Date: Wed, 08 Apr 2015 13:36:24 GMTExpires: Mon, 1 Jan 2001 00:00:00 GMTKeep-Alive: timeout=15, max=100Last-Modified: Wed, 08 Apr 2015 13:36:24 GMTPragma: no-cacheServer: Apache/2.4.6 (Linux/SUSE)Transfer-Encoding: chunkedX-Powered-By: PHP/5.4.20p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM«

<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB"><head>. . . . . .

RFC 2616, RFC 2617http://www.w3.org/Protocols

Page 13: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Browser developer tools

2013/2014 Ambient intelligence: technology and design 13

Page 14: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Performance measures

• Latency: time required for providing a 0 byte http page. Includes the server activation time, the request decoding time, the file access time, the transmission time and the time for closing the connection.

– Unit of measure: http/s or s/http

• Throughput: maximum speed at which infinite-sized pages can be sent.

– Unit of measure: Bytes (Mbytes)/s

• #Requests / s

2013/2014 Ambient intelligence: technology and design 14

Page 15: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Delay time

• T = Latency + ResponseBytes / Throughput

• This equation is valid if:

– The other architecture elements (I/O subsystem, network, ...) are not overloaded

– The web server has not yet reached its maximum workload

• Example:

– Latency: 0,1s

– ResponseBytes : 100kBytes

– Throughput: 800kBytes/s

– T= 0,1s+ 100KBytes / 800KBytes/s =0,225s

2013/2014 Ambient intelligence: technology and design 15

Page 16: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Static web transaction

2013/2014 Ambient intelligence: technology and design 16

Browser

Webserver

Diskaccess

t0

t1

t2

t3

t4

t6

t7

t8

t9

t5

t’0

t’1

total response time

server response time user think time

network transfer time

Page 17: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 17

internet

Web application(PHP, JSP, …)

Browser

DisplayMouse/

Keyboard

Web server(Apache, IIS) HTML file

Image file

Layout engine

IMG

IMG

HTM

HTM

Page 18: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

The most adopted web servers

2013/2014 Ambient intelligence: technology and design 18

Source: http://news.netcraft.com/

http://news.netcraft.com/archives/2015/03/19/march-2015-web-server-survey.html

Page 19: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Application server

• Dynamic page generation and content generation

• Manages the site business logic

• It’s the middle tier between the client browser and the data residing on a database

• Implements the session mechanisms

• Different technologies and architectures are available

2013/2014 Ambient intelligence: technology and design 19

Page 20: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Dynamic web transaction

2013/2014 Ambient intelligence: technology and design 20

Client

Web server

Internet

URL& data

http requestwith data

http responsedisplaypage

TCP/IP

com-mand

browser server application

HTMLsend

Application

para-meters

logic

Page 21: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Adopted standards

• HTTP-POST for sending user-specified data

– In addition to URL-encoding in GET requests

• Technologies for integrating application logic into web servers

– Obsolete: CGI (common gateway interface), ISAPI (internet information server application programming interface), server-side script

– java servlets

– ASP (active server pages), JSP, PHP, PERL, Python as new languages for application development

2013/2014 Ambient intelligence: technology and design 21

Page 22: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

URL (HTTP GET)

2013/2014 Ambient intelligence: technology and design 22

http://www.cad.polito.it/pap/pap.pl?author=Corno

CPU

Application

HTML

Parameters

Disk

Libraries

Page 23: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Dynamic web transaction

2013/2014 Ambient intelligence: technology and design 23

Browser

Webserver

Applicationserver

t0

t1

t2

t3

t5

t6

t7

t8

t9

t4

total response time

application time

total server time

t’0

t’1

Page 24: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 24

internet

Web application(ASP, PHP, JSP, …)

Browser

DisplayMouse/

Keyboard

Web server(Apache, IIS) HTML file

Image file

Layout engine

IMG

IMG

HTM

HTM

Page 25: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Database server

• Stores the data on which the application server works.

• Executes the queries issued by the application server:

– Updates the stored data

– Inserts new data

– Provides back query results

• The most frequent/complex queries can be implemented internally as stored procedures (pre-compiled queries with parameters)

2013/2014 Ambient intelligence: technology and design 25

Page 26: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Example

2013/2014 Ambient intelligence: technology and design 26

Client

Web server

Internet

URL & data

httpreq

httpresp

displaypage

TCP/IP

com-mand

browser server application

HTMLsend

Application

para-meters

database

data

Database

query

Page 27: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Adopted standards

• Cookies for storing the state of a session

• Java, JavaScript, ActiveX, Flash to program the user interface on the browser

• SQL (structured query language), ODBC (open database connectivity) to access data bases

2013/2014 Ambient intelligence: technology and design 27

Page 28: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Database server

• Queries are almost always in SQL

– SELECT * FROM table;

– ....

• Often adopts the relational database model

– Other models can be used• Object model

• Triple model

• The most advanced/complete solutions are called Transaction servers

2013/2014 Ambient intelligence: technology and design 28

Page 29: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Database-driven transaction

2013/2014 Ambient intelligence: technology and design 29

Browser

Webserver

Applicationserver

Databaseserver

t0

t1

t2

t3

t5

t6

t7

t8

t9

t4

t’0

t’1

total response time

application time

total server time

database time

Page 30: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Example (PHP)

<?php$query = “SELECT doc_id FROM key_doc_index, keywords WHERE key_doc_index.key_id = keywords.id AND keywords.key = $_REQUEST[“query”];”;

$rowset = mysql_query($query);

while($row = mysql_fetch_row($rowset)){//elaborate data}?>

2013/2014 Ambient intelligence: technology and design 30

The application composes the query

The query is sent to the db-server and a rowset containing the results is returned

The application elaborates the data

Page 31: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 31

internet

Web application(ASP, PHP, JSP, …)

Browser

DisplayMouse/

Keyboard

Web server(Apache, IIS) HTML file

Image file

Layout engine

IMG

IMG

HTM

HTM Database

Database Server DBMS

SQL

Page 32: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 32

internet

Web application(ASP, PHP, JSP, …)

Browser

DisplayMouse/

Keyboard

Web server(Apache, IIS) HTML file

Image file

Layout engine

IMG

IMG

HTM

HTM Database

Database Server DBMS

SQL

Javascript engine

JSCSS HTM

DOM

CSS stylesheets

Javascript

JS

CSS

Page 33: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Web 2.0

• Web applications support social interaction models

• Peer exchange and user-contributed content instead of rigid publisher/reader pattern

– Online communities

• Rich, dynamic, interactive user interfaces

• Integration of contents across web sites (mashups)

2013/2014 Ambient intelligence: technology and design 33

Page 34: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Rich-Client Asynchronous Transactions

2013/2014 Ambient intelligence: technology and design 34

Client

Web server

Internet

URLhttp

httpdisplaypage

TCP/IP

com-mand

browser server application

HTMLsend

Application

para-meters

database

data

Database

query

Client-sideApplication

runtime

events

DOM

http

XML/JSON

Page 35: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Adopted standards

• Dynamic HTML: DOM, Javascript, CSS– JavaScript, Flash to handle a runtime environment on the

browser

– DOM (XHTML Document Object Model) to allow on-the fly modification of the web page

– CSS 2.1 to modify attribute and handle objects

• AJAX: Asynchronous Javascript and XML– XMLHttpRequest for asynchronous communication to the

server

– Data transfer formats: JSON, XML, RDF, RSS, Atom, FOAF, ...

• Mash-up technology

2013/2014 Ambient intelligence: technology and design 35

Page 36: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Rich-client transaction

2013/2014 Ambient intelligence: technology and design 36

Browser

Webserver

Applicationserver

Databaseserver

t9t0

t1

t2

t3

t5

t6

t7

t8

t4

t’0

t’1

Runtime

Page 37: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 37

internet

Web application(ASP, PHP, JSP, …)

Browser

DisplayMouse/

Keyboard

Web server(Apache, IIS) HTML file

Image file

Layout engine

IMG

IMG

HTM

HTM Database

Database Server DBMS

SQL

Javascript engine

JSCSS HTM

DOM

CSS stylesheets

Javascript

JS

CSS

Data

XML,JSON

Page 38: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

Distributed transactions

2013/2014 Ambient intelligence: technology and design 38

Client

Web server

Internet Application

Web server

InternetApplication

XML/JSON

Page 39: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

AmI control

2013/2014 Ambient intelligence: technology and design 39

Client

Web server

Internet Application

Application

Page 40: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

AmI control via http

2013/2014 Ambient intelligence: technology and design 40

Client

Web server

Internet Application

ApplicationWeb server

Internet,LAN, WLAN

XML/JSON

Page 41: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

General Architecture

2013/2014 Ambient intelligence: technology and design 41

internet

Server application

Client Application

Web server

Database

Database Server DBMS

SQL

Data

XML JSON

XML JSON

internet

Web server

Environment

Page 42: Web Architecture and Technologies - Polito Architecture 2013/2014 Ambient intelligence: technology and design 5 Client Internet Server(s) • Historically, a web browser • But also:

License

• These slides are distributed under a Creative Commons license “Attribution – NonCommercial – ShareAlike (CC BY-NC-SA) 3.0”

• You are free to:– Share — copy and redistribute the material in any medium or format – Adapt — remix, transform, and build upon the material – The licensor cannot revoke these freedoms as long as you follow the license terms.

• Under the following terms:– Attribution — You must give appropriate credit, provide a link to the license, and

indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

– NonCommercial — You may not use the material for commercial purposes. – ShareAlike — If you remix, transform, or build upon the material, you must

distribute your contributions under the same license as the original. – No additional restrictions — You may not apply legal terms or technological

measures that legally restrict others from doing anything the license permits.

• http://creativecommons.org/licenses/by-nc-sa/3.0/

2013/2014 Ambient intelligence: technology and design 42