0% found this document useful (0 votes)
38 views72 pages

Web Applications (1st Part)

This document provides an overview of web applications and distributed systems. It discusses how web applications have evolved from static content in Web 1.0 to include more dynamic and user-generated content in Web 2.0. It also describes how web applications can be developed as distributed systems using either the client-server model with RESTful web services or the SOAP-based web service model. Key concepts covered include resources, URIs, HTTP methods, and representing resources in different formats like JSON, XML, and HTML.

Uploaded by

Víctor C. Lima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views72 pages

Web Applications (1st Part)

This document provides an overview of web applications and distributed systems. It discusses how web applications have evolved from static content in Web 1.0 to include more dynamic and user-generated content in Web 2.0. It also describes how web applications can be developed as distributed systems using either the client-server model with RESTful web services or the SOAP-based web service model. Key concepts covered include resources, URIs, HTTP methods, and representing resources in different formats like JSON, XML, and HTML.

Uploaded by

Víctor C. Lima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 72

Web Applications:

First part
Dr. José Luis Zechinelli Martini
[email protected]
LIS – 4052

Thanks to Dr. Genoveva Vargas Solar, CNRS-LIG, Francia & Dr. Javier Espinosa, Postdoctoral fellow Centro de
Supercómputo, Barcelona, for sharing material about this topic.
A Web App is a Distributed System
n Collection of heterogeneous networked computers which communicate
and coordinate their actions by passing messages
¨ Distribution is transparent to the user so that the system appears as a single
integrated facility
¨ Processes are not executed on a single processor but rather span a number of
processors
B2B interaction
request

response
What is so particular
about Web applications?
http://www.ironpaper.com/webintel/articles/web-design-statistics-2015/#.VcJKIXhZHJI
Requirements
Developing Web Applications
Developing Web Applications
Plan
ü Context and motivation

n The Web as a content provider

n The Web as a service provider

n Distributed architecture models


Waves of Internet
lo g y
Te ch n o H TM L
P
TCP/I

Standard Connectivity Presentation


FTP, e-m
a
In n o gopher il,
vatio Web pa
n ges
Brow
s
Web e the
Web 1.0: Content centred
n Few content creators with the vast majority of users acting as content consumers
n Personal web pages were common, consisting of static pages hosted on web
hosting servers
n Content served from the server's files system instead of a RDBMS
n Pages built using Server Side Includes or CGI
n HTML 3.2-era elements such as frames and tables to position and align elements
on a page
n Proprietary HTML extensions
n HTML forms sent via email
URL Schema and Syntax (i)
n URL Schema
¨ Identifies and provides means for locating a resource

scheme: // host [ : port ] path [ ? query ] [ # fragment ]


e.g., http://portafolios.udlap.mx/portafolios/joseluis.zechinelli/LIS-4021/_layouts/15/start.aspx#/

Allowed characters Reserved characters


0…9 Digit / ? # [ ] @ :
A…Z Alphabet ! $ & ‘ ( ) * + , ; =
- … ~ ASCII symbols
URL Schema and Syntax (ii)
Plan
ü Context and motivation

ü The Web as a content provider

n The Web as a service provider

n Distributed architecture models


Next wave
g y XM L
o
Te chn o l H TM L
P
TCP/I

Standard Connectivity Presentation Program


FTP, e-m
a
In n o gopher il,
vatio Web pa
n ges
Brow Web se
s e th r v ic e s
Web e Prog
ra
Web m the
Web 2.0
n Folksonomy - free classification of information; allows users to collectively classify
and find information (e.g. tagging)
n Rich User Experience - dynamic content; responsive to user input
n User Participation - information flows two ways between site owner and site user
by means of evaluation, review, and commenting; site users add content for
others to see
n Software as a service - Web 2.0 sites developed APIs to allow automated usage,
such as by an app or mashup
Resource
n Key abstraction of information, data and operations:
¨ Everything object (or "thing") in a system can be a resource

n Each resource is addressable via a URI (Uniform Resource Identifier):


¨ Extensible naming schema
¨ Works pretty well on global scale and is understood by practically everybody

¨ Can be human-readable

n Examples:

http://www.facebook.com:80/joseluis.zechinelli?sk=info
URI Types
n Uniform Resource Locator ( URL )
¨ Identifies and provides means for locating a resource
n Uniform Resource Name ( URN )
¨ Persistent even if the resource ceases to exit or is
unavailable
URI Schema
n Defines a set of rules for identifying a resource
n Examples

HTTP Spotify
http://vargas-solar.com spotify:user:jlzechinelli

MAIL Skype
mailto:[email protected] skype:joseluis.zechinelli

GEO LastFM
geo:48.890172,2.249922 lastfm://user/jlzechinelli
Fill Her Up - Sting Fill Her Up - Sting
Interacting with operations
Web services use case
Service
n Component exporting operations accessible via a network

op1

op2 Service
Exported URL
Applications Operations op3

Network
Service Example
n " Retrieve the current song listened by a Deezer user "

XML getCurrentSong( String user ) op2 Service


URL

http://api.deezer.com
Operation Call Example

getCurrentSong( "bob" )

op2 Service
URL

http://api.deezer.com
Operation Call Example

<Song>
<album name=“...” />
<title name=“...” /> op2 Service
… URL
<Song>

http://api.deezer.com
Web Service
n Provides a standard means of
interoperating between
applications running on different Web Service Web Service

platforms
WSDL WSDL
n Exposes an API described in a
SOAP
machine-processable format ( WSDL )
HTTP
n Other systems interact with it using TCP / IP
SOAP messages that are conveyed
using HTTP and other web-based
technologies
Web Service Protocol Stack
n Set of standards addressing interoperability aspects

Used for managing


Service state

Basic
Standards
Interacting with resources
Restful services use case
+
REST in a Nutshell
n REST is all about:
à Resources
à How to manipulate the
resource
à How to represent the
resource in different ways
Designing a Resource Representation
n Understandability - Both Server and Client should be able to understand and
utilize the representation format of the resource.

n Completeness - Format should be able to represent a resource completely. For


example, a resource can contain another resource. Format should be able to
represent simple as well as complex structures of resources.

n Linkability - A resource can have a linkage to another resource, a format should be


able to handles such situations.

30
Representation of Resources
n A resource referenced by one URI can have different representations:
¨ HTML (for browsers), XML (for application), JSON (for JavaScript)

n If the client "knows" both the HTTP application protocol and a set of data formats then it
can interact with any RESTful service in the world
Resource Oriented VS Operation Oriented
Interacting with Resources (i)
n All resources supports the same API (i.e. HTTP operations)
¨ Each operation has a specific purpose and meaning

n Note: The actual semantics of POST are defined by the server


Interacting with Resources (ii)
n HTTP Codes
Interacting with Resources (iii)
n Example
Interacting with Resources (iv)
n Get a resource
Interacting with Resources (v)
n Create/Update a resource
Interacting with Resources (vi)
n Delete a resource
To read

Principled Design of the


Modern Web Architecture
Plan
ü Content and motivation

ü The Web as a content provider

ü The Web as a service provider

n Distributed architecture models:


¨ Client-Server
¨ Design aspects
¨ N-tier architectures
General Architecture
System Layers
n Presentation: Offers operations to a client for
interacting with the system

n Application Logic: Determines what the system


actually does; enforces the business rules and
establishes the business process

n Resource Manager: Deals with the business logic data


(e.g., storage, indexing, and retrieval); it can be any
system providing querying capabilities and persistence
(e.g. DBMS)
N-Tier Architecture Model
n Organizes the layers of a system based on their distribution
Ø 1-Tier (Monolithic)
Ø 2-Tiers (Client-Server)
Ø 3-Tiers (Middleware)
Ø N-Tiers
n System architectures are represented using blocks and arrows
Ø Blocks represent tiers and/or layers
Ø Arrows represent communication among blocks
Monolithic (1-Tier)
n All the layers are centralized in a single place
n Managing and controlling resources is easier
n Can be optimized by blurring the separation
between layers
Client-Server (2-Tiers) (i)
n Several presentation layers can be defined depending on
what each client needs to do
n Takes advantage of clients computing power for creating
more sophisticated presentation layers
à Saves computer resources on the server
n The resource manager only sees one client: the
application logic
à Helps with performance since no extra sessions are maintained
Client-Server (2-Tiers) (ii)
n Introduces the notion of service and
service interface
à The client invokes a service
implemented by a server through an
interface

n All the services provided by a server


define its API (Application
Programing Interface)
Client-Server (2-Tiers) (iii)
n Advantages n Disadvantages
¨ Can off-load work from server to n A single server can only manage a
clients limited number of clients
¨ Server design is still tightly coupled n There is no failure encapsulation; if
and can be optimized by ignoring a server fails, no clients can work
presentation issues
n The load created by a client will
¨ Relatively easy to manage from a
directly affect other clients since
software engineering point of view
they compete for the same resources
3-Tiers
n Fully separates the three layers
n Introduces an additional layer of business logic called
middleware:
¨ Simplifies the design of clients by reducing the number of
interfaces it needs to know
¨ Provides transparent access to the underlying systems
¨ Acts as a platform for inter-system functionality and high
level application logic
¨ Takes care of locating resources, accessing them, and
gathering results
N-Tier
n Architecture resulting from connecting several 3-tier systems to each other.
Client – Server Model
+ Client – Server Abstraction

request
Client Server
response
Execution
Client-Server Characteristics
n State Management
¨ Server-side: persistent or not
¨ Client-side: stateful or stateless
n Communication Model
¨ Connected or disconnected mode (datagrams)
¨ Synchronous or asynchronous
n Server-side Execution Model
¨ One or more processes
¨ Pool of processes or processes on-demand
Server without Persistent Data
n The execution only uses the input parameters:
¨ Does not modify the state of the server
n Ideal situation for:
¨ Fault tolerance
¨ Controlling concurrency

n Example:
¨ A service for computing mathematical functions
Server with Persistent Data
n Successive executions manipulates persistent data:
¨ Modifies the execution context
¨ Introduces problems for controlling concurrent access to resources
¨ Fault tolerance is not guaranteed

n Examples:
¨ Database Server
¨ Distributed File System
Stateless Service (i)
n The server does not keep track of client requests

n Successive request are independents:


¨ Even if global data is modified, the current request dost not have any relation
with previews ones
¨ The order among request is not important

n Example: The service of clock synchronization of a network


Ø NTP service (Network Time Protocol)
Stateless Service (ii)
Stateful Service (i)
n Requests are executed based on the state produced by previews requests
n Order among requests is important
n Examples:
¨ Sequential access to the content of a file
à depends on the file's pointer position
¨ Calling a remote method
à the result of the call depends on the state of the object
Stateful Service (ii)
Stateful Service (iii)
Client-Server Characteristics
ü State Management
ü Server-side: persistent or not
ü Client-side: stateful or stateless
n Communication Model
¨ Connected or disconnected mode (datagrams)
¨ Synchronous or asynchronous
n Server-side Execution Model
¨ One or more processes
¨ Pool of processes or processes on-demand
Connection Modes
n The main difference resides in the reliability of message delivery
n Connection oriented
¨ Message delivery is guaranteed
¨ Order among messages is respected
¨ Free of error (delivery is retried when necessary)
n Datagram oriented
¨ Follows the "best-effort" approach (i.e., there is not guarantees of message
delivery)
¨ Message can arrived duplicated
¨ Order is not respected
Communication Protocols
Synchronous Interaction
n Traditionally used for developing distributed
systems:
¨ Client waits while server processes a request
(blocking call)
¨ Requires both parties to be on-line
n Advantage
¨ Simple to understand and implement
¨ Failures are simple to manage
n Disadvantages
¨ Connection overhead
¨ Higher probability of failures
¨ Solutions:
à Transactions
à Asynchronous interactions
Asynchronous Interaction (i)
n Calls to servers are non-blocking thus clients can continue running:
¨ Clients checks at different times to see if a response is ready
¨ Typically implemented via message queues

n Disadvantage:
¨ Adds complexity to client architecture
n Advantages:
¨ More modular
¨ More distribution modes (multicast, replication, message coalescing, etc.)
¨ More natural way to implement complex interactions between heterogeneous systems
Asynchronous Interaction (ii)
Client-Server Characteristics
ü State Management
ü Server-side: persistent or not
ü Client-side: stateful or stateless
ü Communication Model
ü Connected or disconnected mode (datagrams)
ü Synchronous or asynchronous
n Server-side Execution Model
¨ One or more processes
¨ Pool of processes or processes on-demand
Execution models
n Iterative execution:
¨ Based on a single process

n Concurrent execution:
¨ Based on multiple processes or threads
n Processes are created on-demand

n Processes are selected from a "pool of processes"


Single Process Execution
while (true) {
receive(client_id, message);
extract(message, service_id, params);
result = do_service[service_id](params);
send(client_id, result);
}

Client

Server
Processes Created On-Demand
Proxy Server
while (true) { // código a ejecutar
receive(client_id, message); result = do_service[service_id](params);

extract(message, service_id, params); send(client_id, result);

create_process(client_id, service_id, params); exit;

request Proxy

Client create
execute
response
Server
Pool of Processes
Proxy Servicio
while (true) { // código a ejecutar
result = do_service[service_id](params);
receive(client_id, message);
send(client_id, result);
extract(message, service_id, params);

dispatch(client_id, service_id, params);

request
Proxy
dispatcher

Client
execution
response
Server Servidor’
Servidor’
Server’

You might also like