web-based and cloud systems - universitetet i oslo€¦ · ¡generic extension of the www...

18
INF 5040 1 Web-Based and Cloud Systems INF 5040 autumn 2017 lecturer: Roman Vitenberg 2 INF5040, ifi/UiO ¡ Browser-server WWW application ¡ Geared towards human interaction ¡ Not suitable for automation ¡ Automatic restocking from amazon.com ¡ Sniping in eBay ¡ Web services middleware ¡ Generic extension of the WWW application ¡ Web servers announce and provide services ¡ Web server can be a client of another service Two main flavors

Upload: others

Post on 23-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 1

Web-Based and Cloud Systems

INF 5040 autumn 2017

lecturer: Roman Vitenberg

2INF5040, ifi/UiO

¡Browser-server WWW application¡ Geared towards human interaction¡ Not suitable for automation¡ Automatic restocking from amazon.com¡ Sniping in eBay

¡Web services middleware¡ Generic extension of the WWW application¡ Web servers announce and provide services¡ Web server can be a client of another service

Two main flavors

Page 2: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 2

3INF5040, ifi/UiO

Communicating entities

ClientWeb

ServerProxy

Infrastructure

of Web proxies

Infrastructure

of Web servers

HTTPHTTP

5INF5040, ifi/UiO

¡Protocol translation and conversion¡ Not needed for modern browsers/clients

¡Filtering requests and responses¡Logging¡Compression¡Caching

Web proxy functions

Page 3: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 3

6INF5040, ifi/UiO

¡Cache update protocols¡ Pull with if-modified-since GET HTTP header¡ Lease-based propagation

¡Not as effective for dynamic content¡Cache replacement policies¡ LRU is commonly used and it performs well¡ A number of specialised policies, e.g., Greedy-Dual

Client-side and proxy caches

7INF5040, ifi/UiO

¡Commonly deployed throughout the world

¡Reduces latency and traffic for popular documents

¡ Increases latency for other documents

¡Higher-level proxies require a lot of storage space

Hierarchical proxy caching

Client

Proxy

Proxy

Web Server

1. Look in

Local cache

2. Ask next level proxy

4. Forward request

to Web server

3. Look in

local cache

Page 4: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 4

8INF5040, ifi/UiO

¡Deployed on a per-organisation basis¡Can be combined with hierarchical caches

Cooperative proxy caching

Client

Web Server

Proxy

Proxy

Proxy1. Look in

Local cache

2. Ask neighbor proxies

3. Forward request

to Web server

9INF5040, ifi/UiO

¡Several possibilities for request dispatching¡ Round-robin DNS¡ Content-aware dispatcher inspecting HTTP requests¡ TCP-level switch

Simple server-side backend

Client

Web ServerProxy

Web Server

Web Server

Request dispatcher

Page 5: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 5

10INF5040, ifi/UiO

¡Placement of data/object replicas¡ See the lecture on replication…¡ A number of evaluation metrics¡ Latency (real-time and the number of hops)¡ Bandwidth (available and network usage)¡ Financial

¡Consistency enforcement¡ See the lecture on replication…

¡Redirection of client requests

Content-distribution network (CDN)

11INF5040, ifi/UiO

Redirection of client requests in an Akamai CDN

ClientWeb

Server

CDNServer

Regular DNS system

CDN DNS server

Cache

1. Get base document

2. Document with refs

to embedded documents

3.

4.

DNS lookups

Return IP address of

client-best server

5. Get embedded

documents7. Embedded documents

6. Get embedded documents

(if not already cached)

Page 6: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 6

12INF5040, ifi/UiO

¡ Allows an application-specific client to communicate with a service over a functionality-specific API

¡ Allows a client program in an organisation to communicate with a server program in another

¡ Allows complex applications that integrate and compose services from other services

¡ Because the interaction is generic Web-services cannot be directly accessed by browsers

Web services

13INF5040, ifi/UiO

Example from the Coulouris book

hotel booking a

Travel Agent

flight booking a

hire car booking aService

Client

flight booking b

hotel booking b

hire car booking b

Page 7: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 7

14INF5040, ifi/UiO

¡Many well-known web sites offer a Web-services interface to their clients¡ Amazon, Yahoo, Google, eBay…

Applications of Web Services

15INF5040, ifi/UiO

Architecture of Web Services

Client application

Stub

Communication

subsystem

Client machine

Client application

Stub

Communication

subsystem

Server machine

Service description (WSDL)

Directory service (UDDI)

SOAP over HTTP

Look up a service

Publish service

Generate stub from

WSDL

Generate stub from

WSDL

Page 8: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 8

17INF5040, ifi/UiO

WSDL description

abstract concrete

how where

definitions

types

target namespace

interface bindings servicesmessage

document style request-reply style

Description of a service

18INF5040, ifi/UiO

¡ Types¡ Name and type of exchanged values (similar to declaration of variables)

¡ Messages (operations)¡ Interface¡ Operation parameters

¡ In-Out, In-Only, Out-In, Out-only…

¡ Binding¡ The choice of communication protocol¡ typically SOAP, HTTP, or MIME, but others are also possible (e.g., GIOP in

order to communicate with Corba)

¡ Services¡ Specific endpoint addresses, one for each binding ¡ For the SOAP binding, it will be a URI of the service location

WSDL

Page 9: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 9

19INF5040, ifi/UiO

¡URL is the simplest form of URI¡ Based on DNS names¡ Partly location-dependent (in any case dependent on

domain names of the mashine)

¡URN (Uniform Resource Names) is another possibility that is location independent¡ But they are also more prone to name clashes¡ Dependent on Directory Service – ”Universal Directory

and Discovery Service UDDI”

URI – Uniform Resource Identifier

20INF5040, ifi/UiO

¡A language for describing message formats ¡Defines how the message is parsed¡UNICODE-based¡ Readable by both human and machines¡ Ineffective space-wise

¡A language that is suitable to represent a hierarchical data structure in a flat UNICODE-based form

XML – Extensible Markup Language

Page 10: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 10

21INF5040, ifi/UiO

XML definition example

<person id="123456789"><name>Smith</name><place>London</place><year>1934</year><!-- a comment -->

</person >

23INF5040, ifi/UiO

Schema for the Person-structure

<xsd:schema xmlns:xsd = URL of XML schema definitions ><xsd:element name= "person" type ="personType" />

<xsd:complexType name="personType"><xsd:sequence>

<xsd:element name = "name" type="xs:string"/> <xsd:element name = "place" type="xs:string"/> <xsd:element name = "year" type="xs:positiveInteger"/>

</xsd:sequence><xsd:attribute name= "id" type = "xs:positiveInteger"/>

</xsd:complexType></xsd:schema>

Page 11: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 11

24INF5040, ifi/UiO

¡Defines how XML should be used to represent the content of messages

¡Defines how a pair of messages can form a request/reply template

¡Rules regarding how message recipient should process contained XML-elements

¡How HTTP should be used for exchanging SOAP messages

SOAP – Simple Object Access Protocol

25INF5040, ifi/UiO

SOAP Message

envelope

header

body

header element

body element

header element

body element

Envelope, Header, and Body

Page 12: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 12

26INF5040, ifi/UiO

SOAP message without the header

m:exchange

env:envelope xmlns:env =namespace URI for SOAP envelopes

m:arg1

env:body

xmlns:m = namespace URI of the service description

Hellom:arg2

World

27INF5040, ifi/UiO

SOAP-response

env:envelope xmlns:env = namespace URI for SOAP envelope

m:res1

env:body

xmlns:m = namespace URI for the service description

m:res2World

m:exchangeResponse

Hello

Page 13: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 13

28INF5040, ifi/UiO

Example of a SOAP message embedded in HTTP

endpoint address

action

POST /examples/stringerHost: www.cdk4.netContent-Type: application/soap+xmlAction: http://www.cdk4.net/examples/stringer#exchange

<env:envelope xmlns:env= namespace URI for SOAP envelope ><env:header> </env:header><env:body> </env:body></env:Envelope>

HTT

P he

ader

29INF5040, ifi/UiO

Infrastructure and components -summary

Security

Service descriptions (in WSDL)

Applications

Directory service

Web Services

XML

Choreography

SOAP

URIs (URLs or URNs) HTTP, SMTP or other transport

Page 14: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 14

30INF5040, ifi/UiO

¡Many similarities, but¡Some object concepts do not exist¡ Cannot instantiate and remove objects¡ Garbage collection is irrelevant¡ Using simpler Universal Resource Identifiers instead of

Remote Object References¡“Web Services are not Distributed Objects” by

Werner Vogels¡“Like it or not, Web Services are Distributed

Objects” by Ken Birman

Main differences from distributed objects

31INF5040, ifi/UiO

• The scope of deployment• CORBA: inside one organisation or a consortium of

mutually known collaborating organisations• Web Services: truly global• Difference in the naming and references¡ WS discovery is based on DNS that is scalable and global

• Deployment vs communication middleware• Corba: both• Web services: communication only

• Interoperability

Web services vs CORBA

Page 15: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 15

32INF5040, ifi/UiO

• Ease of use and the learning curve¡ Web Services¡ Based on HTTP and XML infrastructure that already exists in most

operating systems and platforms¡ Messages are human-readable¡ Only additionally requires API for SOAP

¡ CORBA: installation/administration + high learning curve

• Efficiency• Web Services:¡ Long messages that it takes time to parse¡ Message processing hundreds of times slower compared to CORBA

Web services vs CORBA (cont’d)

33INF5040, ifi/UiO

¡Disadvantages of SOAP/WSDL¡ its complexity: tools are required to create a client¡ heavier on bandwidth : SOAP requires a heavy XML

wrapper around each request or response¡ complicated security rules

¡Any lighter type of web services addressing above issues?¡ Representational State Transfer (REST)¡ an architecture style for designing networked applications¡ relying on a stateless, client-server, cacheable communication, e.g.,

HTTP¡ idea: rather than using complex mechanisms such as CORBA or

SOAP to connect between machines, simple HTTP is used

From heavyweight to lightweight web services

Page 16: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 16

34INF5040, ifi/UiO

¡ Two fundamental aspects:¡ Resources: Every distinguishable entity is a resource, e.g., a database entity,

a physical device, etc.¡ URLs Identify Resources: Every resource is uniquely identified by a URL,

e.g., http://www.example.com/hr/employee/1428

¡ Additional key elements:¡ communicate over a protocol adhering to REST architectural style, e.g., HTTP ¡ Entities are uniquely addressable using a universal syntax, e.g., HTTP URI syntax

(paths, parameters, etc.)¡ features a constrained set of well-defined operations, e.g., HTTP methods (GET,

POST, PUT, DELETE) ¡ support a constrained set of content types, e.g., HTTP media types (xml, json,

html, plain text, etc)

¡ An example:

RESTful web services

Client

DELETE http://www.example.com/hr/employee/1428

HTTP Status: 200 (OK)Response Headers Web Server

EmployeeResources

¡ Definition:¡ Clouds are pay-per-use services offering on-demand compute, network,

and storage capacity

¡ Three classes of cloud; viewed as a layered architecture:¡ Infrastructure as a Service (IaaS)¡ Platform as a Service (PaaS)¡ Software as a Service (SaaS)

Cloud Computing

Page 17: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 17

¡ IaaS¡ offering virtualized resources (computation, storage, and

communication) on-demand¡ several choices of OS and a customized software stack¡ e.g., Amazon EC2: offering VMs with a software stack

customizable like an ordinary server

¡PaaS¡ offering an environment to create and deploy applications¡ no need to know low-level technical config., e.g., number of

processors or amount of memory¡ offering multiple programming models and specialized services,

e.g., data access and authentication¡ e.g., Google AppEngine: for developing and hosting Web

apps written in Python or Java

Types of clouds – (1)

¡SaaS¡ applications reside on the top of the cloud stack¡ accessed by end users through Web portals¡ desktop apps such as word processing as a service in the

Web¡ e.g., Salesforce.com: offering business productivity apps

(CRM)

Types of clouds – (2)

Page 18: Web-Based and Cloud Systems - Universitetet i oslo€¦ · ¡Generic extension of the WWW application ¡Web servers announce and provide services ... ¡Can be combined with hierarchical

INF 5040 18

¡ On-Demand Self-Service¡ consumers expect on-demand, nearly instant and unilateral access to

resource

¡ Measured Service¡ measuring the usage of cloud resources for each individual

consumer through its metering capabilities

¡ Elasticity¡ users expect clouds to rapidly provide resources in any quantity at

any time

¡ Resource Pooling¡ physical and virtual resources dynamically assigned and reassigned

according to consumer demand

¡ Broad Network Access¡ Supporting a range of devices, transport protocols, interfaces, and

security technologies for accessing cloud services

Five essential characteristics of clouds