Client/Server Architectures

thickbugΛογισμικό & κατασκευή λογ/κού

28 Οκτ 2013 (πριν από 3 χρόνια και 5 μήνες)

47 εμφανίσεις

Web Application
Architecture

يناهاك نسحمرتكد

http://www.um.ac.ir/~kahani/

رتویپماک ینابم
-
يناهاك رتكد

Client/Server Systems


Networked computing model


Processes distributed between clients and
servers


Client


Workstation (usually a PC) that
requests and uses a service


Server


Computer (PC/mini/mainframe) that
provides a service


For DBMS, server is a database server


رتویپماک ینابم
-
يناهاك رتكد

Client/Server Architectures


File
Server

Architecture


Database Server Architecture


Three
-
tier/N
-
tier Architecture

Client does
extensive processing

Client does little
processing

رتویپماک ینابم
-
يناهاك رتكد

File Server Architecture


All processing is done at the PC that requested the
data


Entire files are transferred from the server to the
client for processing.


Problems:


Huge amount of data transfer on the network


Each client must contain full DBMS


Heavy resource demand on clients


Client DBMSs must recognize shared locks, integrity
checks, etc.


FAT CLIENT

رتویپماک ینابم
-
يناهاك رتكد

File Server Architecture

FAT CLIENT

رتویپماک ینابم
-
يناهاك رتكد

Database Server Architectures


2
-
tiered approach


Client is responsible for


I/O processing logic


Some business rules logic


Server performs all data storage and access processing



DBMS is only on server


Advantages


Clients do not have to be as powerful


Greatly reduces data traffic on the network


Improved data integrity since it is all processed centrally


Stored procedures



some business rule enforcement
handled by server

رتویپماک ینابم
-
يناهاك رتكد

2
-
Tier Architecture


Advantages:


Compiled SQL statements


Reduced network traffic


Improved security


Improved data integrity


Thinner clients

رتویپماک ینابم
-
يناهاك رتكد

2
-
Tier Architecture


Disadvantages


Writing stored procedures takes time


Proprietary nature of stored procedures
reduces portability


Each client must be loaded with the
applications used at that location


Upgrades to an application require that
each client be upgraded separately

رتویپماک ینابم
-
يناهاك رتكد

Database server architecture

Thinner
clients

DBMS only
on server

رتویپماک ینابم
-
يناهاك رتكد

3
-
Tier or N
-
Tier
Architectures


Three layers:


Client



Application server


Database server


Thin Client



PC just for user interface and a little
application processing. Limited or no data
storage.

GUI interface

(I/O processing)

Business rules

Data storage

رتویپماک ینابم
-
يناهاك رتكد

Three
-
tier architecture

Thin Clients

Business rules on
separate server

DBMS only on
DB server

رتویپماک ینابم
-
يناهاك رتكد

4
-
Tier or N
-
Tier
Architectures


Four layers:


Client



Web Server


Application server


Database server


Thinnest Client



PC just for user interface and minimal application
processing. Almost no data storage (sometimes no
hard drive).

Browser

رتویپماک ینابم
-
يناهاك رتكد

WebApp simple model

Browser

Web Server

HTTP Requests

HTTP Responses

Web Pages

On Disk

Disk
I/O

رتویپماک ینابم
-
يناهاك رتكد

Programmability


Static


Assumes documents created before they are
requested.


Drawback to the simple document model

رتویپماک ینابم
-
يناهاك رتكد

Server
-
side
programmability


The request causes the response to be
“generated”


There are several ways to do this:


CGI


ASP


PHP


Servlets

رتویپماک ینابم
-
يناهاك رتكد

CGI


Common Gateway Interface


URL (i.e., the request) determines the name of a
program to run


CGI provides a way to specify a set of
parameters to give the program.


Result of running the program is the generated
web document that is returned to the client.


رتویپماک ینابم
-
يناهاك رتكد

CGI Example

http://wwwx.cs.unc.edu/~kmp/cgi/ex
1
.cgi?from=ketan&mesg=hello

Server name

Program name

Parameter “from”
set to “ketan”

Parameter “mesg”

set to “hello”

رتویپماک ینابم
-
يناهاك رتكد

ASP


Active Server Pages (Microsoft product)


Uses Visual Basic for scripting.


Programs embedded into page.


Special objects provided for managing CGI query
request and keeping state.


Integrated into the Microsoft Internet Information
Server
3.0

رتویپماک ینابم
-
يناهاك رتكد

ASP Basics


ASP files are plain ASCII text


Scripts in VBScript or JavaScript


Server side scripts are enclosed in <% and %> tags


Only HTML is sent to client


Users can use the <SCRIPT> tag to run additional
interpreters (i.e., PERL)


Giving the file an extension of ASP makes it an
Active Server Page


رتویپماک ینابم
-
يناهاك رتكد

ASP Script Processing


ASP read line by line


Server script processed and results sent to client


Server
-
side includes also available
-

processed
first


HTML or client
-
side script passed to client


Integrated script debugger in IIS
4.0
/
5.0

رتویپماک ینابم
-
يناهاك رتكد

PHP


PHP is an interpreted scripting
language.


Document contains a PHP program
mixed with HTML (like ASP)


Strong database support


Growing popularity

رتویپماک ینابم
-
يناهاك رتكد

PHP Language Basics


All PHP code is contained in one of
several script tags:


<?

// Some code

?>



<?php

// Some code here

?>


<script language=“PHP">


// Some code here

</script>


رتویپماک ینابم
-
يناهاك رتكد

Java Servlets


Java version of Perl/CGI


Java program created and run to
service request and generate reply


Special features for state management.


Can take advantage of any/all other
Java packages and features


Key advantage: persistence

رتویپماک ینابم
-
يناهاك رتكد

Java Server Page (JSP)


Java Server Pages (JSP)


A simplified, fast way to create dynamic web content


HTML or XML pages with embedded Java Code or Java
Beans


Can be a mix of template data in HTML/XML with some
dynamic content


A JSP is a complied to a Java Servlet automatically by the
Servlet container, it is then cached


Latest JSP Spec is
1.2

رتویپماک ینابم
-
يناهاك رتكد

JSP Basics


Used in JSP pages, pages that end *.jsp


Comment <%
--

Comment
--
%>


Declaration <%! int x =
0
; %>


Expression <%= expression %>


Outputs to the Response stream


Like a “printf” to the browser


Do NOT use semi
-
colon to terminate the line


Scriplets
-

contains Java Code


<% code fragments %>




رتویپماک ینابم
-
يناهاك رتكد

Web App Model II

Browser

Web Server

HTTP Requests

HTTP Responses

Info

On Disk

Disk
I/O

Servlet

Programmable,
dynamic,
document
construction

رتویپماک ینابم
-
يناهاك رتكد

At the other end.


End result of server
-
side mechanisms
is a web document.


Client receives and displays the
document.


What does display the document
mean?

رتویپماک ینابم
-
يناهاك رتكد

Client Side Technologies


HTML


JavaScript


CSS


DHTML


XML


XSL


Java Applets


Plugins

رتویپماک ینابم
-
يناهاك رتكد

Client Side Scripting


Client side scripts are embedded inside HTML document. They
are interpredted by browser.


When Web brower encounters a script, it calls a scripting
interpreter, which parses and deciphers the scripting code.


Provide response to questions and queries without
interventions from the server


Validate user data


Calculate expressions


Link to other applications


Java script develped by Netscape Navigator
2
. Also supported
in Microsoft Internet Explorer
3
and laster (but called Jscript).


VB Script is a subset of the Microsoft Visual Basic language.

رتویپماک ینابم
-
يناهاك رتكد

Interactive content: choice
between fat client vs. thin client.


Client side advantages


Faster response time


Better animation


Simpler server programs


Client side disadvantages


Longer load time


Browser compatibility


Complexity in web page design

رتویپماک ینابم
-
يناهاك رتكد

Javascript


Advantage


Easy to learn and use


Wide browser support


Protection of local
resources



Disadvantage


Browser compatibility
issues


Not object oriented


Unable to gain access
to local resources

رتویپماک ینابم
-
يناهاك رتكد

Java applet


Advantage


High functionality


Object oriented and full
graphics functionality


Protection of local
resources


Wide Browser support


With Java
2
, be able to
gain access to local
resources with signed
applets


Disadvantage


JVM compatibility
issues


Difficulty to install
and configure for
local access


Loading time and
performance may be
poor for large
application
.


رتویپماک ینابم
-
يناهاك رتكد

Active X controls


Advantage


High functionality


Object based and full
graphics functionality


Complete access of
local resources with
signed controls


Disadvantage


Only runs on
Microsoft platforms


Trust and protection
issues

رتویپماک ینابم
-
يناهاك رتكد

Plug
-
in


Advantage


Easy to learn and install


Can be used for very
special applications (e.g.
streaming audio/video,
viewing documents,
3
-
D
animation)


High functionality


Protection of local
resources


Disadvantage


Need installation


Unable to gain access
to local resources

رتویپماک ینابم
-
يناهاك رتكد

Web App Model III

Applet

Programmable,
dynamic
interface to the
document

Browser

Web Server

HTTP Requests

HTTP Responses

Info

On Disk

Disk
I/O

Servlet

Programmable,
dynamic,
document
construction

رتویپماک ینابم
-
يناهاك رتكد

Backend Databases


Using a DBMS instead of files


Using SQL to store/retrieve data


ODBC


JDBC

رتویپماک ینابم
-
يناهاك رتكد

Web App Model IV

Applet

Programmable,
dynamic
interface to the
document

Browser

Web Server

HTTP Requests

HTTP Responses

DB

On Disk

SQL

Servlet

Programmable,
dynamic,
document
construction

Database

Structured,
table
-
based,
information
storage

رتویپماک ینابم
-
يناهاك رتكد

MVC

رتویپماک ینابم
-
يناهاك رتكد

Web App As MVC

Applet

Programmable,
dynamic
interface to the
document

Browser

Web Server

HTTP Requests

HTTP Responses

DB

On Disk

SQL

Servlet

Programmable,
dynamic,
document
construction

Database

Structured,
table
-
based,
information
storage

Model

View

Controller