Transcript Server
Introduction
3-Tier Client/Server Overview
by
Gary Rau
DS513
April 29, 1999
http://people.ce.mediaone.net/grau/clientserver.html
What is Client/Server?
• 1) Client/Server describes the relationship
between two computer programs in which
one program, the client, makes a service
request from another program, the server,
which fulfills the request.
• 2) Tiers describe the logical partitioning of
an application across clients and servers.
2-Tier and 3-Tier Architecture
• 2-Tier splits the processing load in two.
Application logic runs on client, which
communicates with data on server.
• 3-Tier splits the processing load between
clients that run user interface logic,
application server running business logic,
and database/legacy application.
Characteristics of Client/Server
Systems
•
•
•
•
•
•
•
•
•
Service
Shared resources
Asymmetrical protocols
Transparency of location
Platform independence
Message-based exchanges
Encapsulation of services
Scalability
Integrity
2-Tier vs 3-Tier Comparison I
Characteristic 2 3
Comments
System
administration
X
Less complex; the application can be
centrally managed on the server
Security
X
High; fine-tuned at the service or
method level
Encapsulation
of data
X
High; client invokes services or methods
Performance
X
Good; only service requests and
responses are sent between clients and
servers
2-Tier vs 3-Tier Comparison II
Characteristic
2 3
Comments
Scale
X
Excellent; concentrates incoming
sessions; can distribute loads across
multiple servers
Application
reuse
X
Excellent; can reuse services and objects
Ease of
development
Server to
server
infrastructure
X
High
X
Yes; via server-side middleware
2-Tier vs 3-Tier Comparison III
Characteristic 2 3
Comments
Legacy
application
integration
X
Yes; via gateways encapsulated by
services or objects
Internet
support
X
Heterogeneous
database
support
X
Excellent; thin clients are easier to
download as applets or beans; remote
service invocations distribute the
application load to the server
Yes; can use multiple databases within
the same transaction
Rich
communication
choices
X
Yes; supports RPC, messaging, queued
delivery, publish-and-subscribe, and
broadcast
2-Tier vs 3-Tier Comparison IV
Characteristic 2 3
Hardware
architecture
flexibility
X
Availability
X
Comments
Excellent; all three tiers may reside on
different computers, or the same
computer; with component-based
environments, the second tier can be
distributed among multiple servers as
well
Excellent; can restart the middle tier
components on other servers
Client/Server Technologies
•
•
•
•
•
•
File Servers
Database Servers
Transaction Servers
Groupware Servers
Object Application Servers
Web Application Servers
Client/Server with
File Servers
Client
Communication Protocols
Server
Server
Page
Server
Production
Data
Application
File
Server
File Calls
Client/Server with
Database Servers
Client
Communication Protocols
Server
Server
Page
Server
Production
Data
Application
DBMS
Server
SQL Calls
Client/Server with
Transaction Servers
Client
Communication Protocols
Server
Server
Page
Server
Production
Data
Application
DBMS &
TP Monitor
Transactions
Client/Server with
Groupware Servers
Client
Communication Protocols
Server
Server
Page
Server
Production
Data
Application
Groupware
Server
Groupware Messages
Client/Server with
Object Application Servers
Client
Communication Protocols
ORB
ORB
Server
Server
Page
Server
Objects
Application
Object
Services
Remote Method Invocation
Client/Server with
Web Application Servers
Client
HTML & Forms
Communication Protocols
Java
Server
Server
Page
Server
Application
HTML Documents
CGI
Application
HTTP over TCP/IP
Middleware I
• The “/” in Client/Server
• All the distributed software needed to
support interactions between clients and
servers
• Client-side API to invoke a service
• Transmission of request and response over
network
Middleware II
• Provide platform for running server-side
components; responsible for:
• Load balancing
• Integrity of transactions
• High availablity
• Secure environment
Client/Server
Software Infrastructure
Client
Middleware
Server
Service-Specific
Browser
Objects
ODBC | TxRPC | Mail | ORB | HTTP
DSM
GUI/OOUI
SNMP | CMIP | Tivoli/ORB
Web
Groupware
NOS
OLTP
Directory | Security | Distributed File
RPC
DSM
OS
| Messaging | Peer-to-Peer
Custom
Transport Stack
Server
NetBIOS | TCP/IP | IPX/SPX | SNA
DBMS
DSM
OS
Component-Based Architecture
• Develop in small steps (4X4)
• Applications reuse components
• Encapsulate services
• Off-the-shelf, mix-and-match
• Component environments get better with
age
Component Types
• Services encapsulate a business function
• Objects encapsulate specific data with the
associated business functions
• Stateless objects retrieve required instance data
when needed, and update database when done
• Stateful objects are unique. Changes in state must
be captured by the infrastructure.
Design Patterns
• Greenfield
• Turbocharger
• Integrator
Greenfield Pattern
Graphical
User Interface
GUI/OOUI
Services
Database
TP Monitor or OTM
DBMS
Turbocharger Pattern
Graphical
User Interface
GUI/OOUI
Services and Data
TP Monitor or OTM
DBMS
Middle-Tier Database
Existing
System
Integrator Pattern
Graphical
User Interface
GUI/OOUI
Services and Data
TP Monitor or OTM
DBMS
Middle-Tier Database
Existing
System
When to use 3-Tier
• > 50 services or classes
• > 1 application language or development organization
• > 1 different data source
• > 3 years application life (especially if modifications/additions are
expected)
• > 50,000 transactions per day
• > 300 users on same system using same database
• significant interapplication communication
• growth expectations
Secrets for 3-Tier Success
•
•
•
•
•
•
•
•
•
•
Keep it simple
Design up front
Buy, don’t build
Rely on industry standards
Use a TP Monitor or OTM
Take baby steps
Use outside help
Address system management during development
Test, test, test
Develop a rollout plan
Overview of scripting lang.
• Scripting languages are used for adding
client side interaction, publishing live and
dynamic data to web site and an ability to
communicate with components in
application server is making them a very
important in building multitier architecture
for organizations.
Where scripting lang is important
• 1) Datawarehousing. Plays a major role in
publishing data out to web
• 2) Internet and Intranet Applications. eg Fed
Ex.
• 3) Applications where deployment is major
pain and has lot of remote users.
Where they fit in mutitier architecture
Client
Middle Tier
Web Server
File
System
HTML Pages
Data
Runtime Environment
Client
Middle Tier
Data
Web Server
File
System
HTML Pages
Page
Server
Production
Data
Templates,
Scripts
Runtime Environment
Client
Middle Tier
Data
Web Server
File
System
Page
Server
HTML Pages
Production
Data
Templates,
Scripts
Transaction
Server
Components:
Enterprise JavaBeans,
ActiveX, CORBA
Production
Data
Production
Data
Runtime Environment
Client
Middle Tier
Data
Web Server
File
System
Page
Server
HTML Pages
Production
Data
Templates,
Scripts
Transaction
Server
Interface
Custom
Server
Components:
Enterprise JavaBeans,
ActiveX, CORBA
Custom Objects
Production
Data
Production
Data
Production
Data
Production
Data
Runtime Environment
Client
Very Thin
Middle Tier
Browser
Data
Web Server
File
System
Page
Server
HTML Pages
Production
Data
Templates,
Scripts
Transaction
Server
Interface
Custom
Server
Components:
Enterprise JavaBeans,
ActiveX, CORBA
Custom Objects
Production
Data
Production
Data
Production
Data
Production
Data
Runtime Environment
Client
Very Thin
Middle Tier
Browser
Web Server
File
System
Page
Server
HTML Pages
Thin
Data
Production
Data
Templates,
Scripts
Browser
Transaction
Server
Components
Interface
Custom
Server
Components:
Enterprise JavaBeans,
ActiveX, CORBA
Custom Objects
Production
Data
Production
Data
Production
Data
Production
Data
Scripting in Multitier Architecture
Client
Very Thin
Middle Tier
Browser
Web Server
File
System
Page
Server
HTML Pages
Thin
Transaction
Server
Components
Interface
Rich
Components
Production
Data
Templates,
Scripts
Browser
Stand-alone
Application
Data
Custom
Server
Components:
Enterprise JavaBeans,
ActiveX, CORBA
Custom Objects
Production
Data
Production
Data
Production
Data
Production
Data
Thick or thin client ??
How user utilize
system?
Heavy data
entry
VB Client
Heavy Batch
processing
VB Client
Instant Report
Access
ASP Client
Mainly External
Access
ASP Client
System consideration based on heavy database
access and development team
Major vendors supporting scripting language deployment
Page Server
client
Sybase PowerDynamo
Active Server pages
Netscape Livewire(javascript)
Cold Fusion
browser
Database
Thick
client
JaguarCTS
MTS
SilverStream
Oracle app server
NetDynamics
Component Server
Where CGI fits in
• CGI. The classic way to perform server-side functions is
via Common Gateway Interface (CGI). Many CGI
programs use Perl, a scripting language well-suited to the
task. However, you can write CGI programs in practically
any language including C++, Python, and Java. Without
careful planning, CGI can introduce security holes in your
server, and CGI programs are usually hard to debug and
difficult for casual programmers to write.
Server side scripting(eg ASP)
• ASP is a deployment environment for server
side scripting
• Client call the page server where the scripts
resides.
• Scripts then query against the database or
components to create dyanamic content on
the client.
Server side scripting(eg ASP)
• Jscript(competition of javascript) and
Vbscript are the scripting languages used in
ASP environment.
• ASP files on the server can be updated at
any time. Simply save the changes to the
file and the script will be automatically
compiled the next time the Web page is
loaded.
Server side scripting(eg ASP)
• ASP includes five standard objects for global use
• Request -- To get information from the user
• Response -- To send information to the user
• Server -- To control the Internet Information Server
• Session -- To store information about and change
settings for the user's current Web-server session
• Application -- To share application-level information
and control settings for the lifetime of the
application
VBscript(Overview)
• Visual Basic Scripting Edition, also known as VBScript,
enables authors to create scripts using a subset of the
Microsoft Visual Basic language. If you are already a
Visual Basic programmer, or if you are not a programmer
but are looking for a scripting language that is easy to
learn, VBScript might be the right language for you.
VBScript is implemented as a fast, portable interpreter for
use in Web browsers and applications that use ActiveX™
controls, Java applets, and OLE Automation servers.
VBScript -- Features
– Error handling. VBScript has a subset of the
error handling provided by Visual Basic. This
includes the error object and on error resume
next. Error handling is very important when
developing server-side code, since most of the
functionality will require access to external
COM objects, which could throw errors.
– Formatting. VBScript has the ability to format
dates, numbers, and currency built into the
language.
VBScript -- Features
– Easier COM integration. Many COM objects
return information in the form of a collection.
VBScript has built-in support for iterating
through collections
– Standard Event-binding Syntax. Visual Basic
developers will immediately recognize the
object_event (sub button1_onclick) naming
convention for event handlers. VBScript works
in exactly the same way, so in any application
that supports event binding (such as Internet
Explorer, Outlook, and Windows Scripting
Host), you can use this syntax for your event
hook-up code.
VBScript -- Advantages
– Easy to understand and master. VBScript's biggest asset
is that it's Basic, a language designed to be learned
quickly. Visual Basic has brought Basic users some of the
advantages of more complex languages, while not losing
sight of the fact that the language should be easy to
understand.
– It's Visual Basic. All the skills learned with VB instantly
apply to VBScript. Also, an enormous community exists to
provide training, books, and magazines for learning Visual
Basic.
– Flexible. VBScript can be used in a wide variety of
applications, and Microsoft is committed to ensuring that
wherever script is part of an application, VBScript will be
included.
VBScript --- Syntax
• <CENTER>
•
<P>
•
<H2>Hello, world sample</H2>
•
<INPUT TYPE=BUTTON VALUE="Click me"
NAME="BtnHello">
• </CENTER>
• <SCRIPT LANGUAGE="VBScript">
• <!--
Sub BtnHello_OnClick
MsgBox "Hello, world!", 0, "My first active
document"
•
End Sub
• -->
• </SCRIPT>
•
•
JScript(Overview)
• JScript is Microsoft's implementation of an ECMAcompliant scripting language (like JavaScript) that is
targeted specifically to the Internet. Like VBScript, JScript
is implemented as a fast, portable interpreter for use in
Web browsers and applications that use ActiveX controls,
Java applets, and OLE Automation servers. JScript is not
Java and has nothing to do with Java. It is closer in syntax
to C or C++.
Jscript Features
– Dynamic: JScript was designed as a completely dynamic
language; that is, you can effectively redefine your
program on the fly. While this has a number of potential
disadvantages, it does give you the ultimate flexibility in
your scripts. This is particularly useful in DHTML
programming, since DHTML allows you to dynamically
manipulate the object model. If you really want to drive
DHTML, you might want to consider using JScript instead
of VBScript.
– Object oriented: JScript certainly isn't a traditional classbased, object-oriented language, but it does provide an
effective alternative based on prototypes. This allows you
to reap the benefits of object orientation without the
statically defined nature of classes.
Jscript - Features
– Regular expressions: A main reason why Perl
has such a huge following. Regular expressions
add the ability to search for expressions in
strings. This is exceptionally useful on the server
and, increasingly, on the client.
– Eval: Provides the ability to immediately
evaluate code at runtime. This allows you to
dynamically redefine logic dependent at run
time. This is especially useful when used in
conjunction with Remote Scripting, which works
with VBScript as well.
Jscript -- Advantages
– Broad reach. JScript is pretty much guaranteed
to run in any browser, anywhere. If your page
really must work in any browser, this is the
language for you.
– All those books in the bookstore. How many
books can there be? If you want to learn JScript,
there are myriad books to help you.
– Similarity to C and Java. If you are a C or Java
programmer, the JScript syntax is going to be
familiar to you.
JavaScript Overview
• Netscapes compact, object-based scripting
language for developing client and server
Internet applications.
• Not Java ….. Or is it?
Client-side JavaScript
• Embedded directly with HTML
• As with HTML, JavaScripts functions are
built into the browser
• Example code:
<script language="JavaScript">
<!-document.write("Hello World!");
//-->
</script>
LiveConnect in JavaScript
• Allows Java and JavaScript code to
communicate with each other
– From JavaScript, you can instansiate Java
objects and access their public methods and
fields
– From Java, you can access JavaScript objects,
properties and methods
LiveConnect in JavaScript
• Example Code:
<SCRIPT>
<!-if ((navigator.appVersion.indexOf("4.") != -1) && (navigator.appName.indexOf("Netscape") != -1)
ip = "" + java.net.InetAddress.getLocalHost().getHostAddress();
document.write("Your IP address is " + ip);
}
else {
document.write("IP Address only shown in Netscape with Java enabled!");
}
//-->
</SCRIPT>
ServerSide JavaScript
• Serve more Client JavaScript and HTML
• Database Connectivity through LiveWire
• Corba Object Connectivity through
LiveConnect
Database Connectivity - LiveWire
Corba Connectivity - LiveConnect
SilverStream Application Server
SilverStream Overview
• What is SilverStream
• The birth and success of SilverStream
SilverStream’s 3-tier Architecture
Database Server
Client
SilverStream HTTP
Server
Database Server
Tier 1
Tier 2
Tier 3
Tier 1: SilverStream’s client(s)
Tier 2: SilverStream’s application server
Tier 3 : the database server(s)
Benefits of SilverStreams 3-Tier
Architecture
• Security management
• Code Management
• Data Valication
SilverStream and Firewalls
External
SilverStream
Client
SilverStream
Client
P
r
o
x
y
S
e
r
v
e
r
Internal
F
I
r
e
w
a
l
l
Database Server
SilverStream
Server
Database Server
SilverStream
Client
SilverStream and Web Servers
SilverStream’s client connections
Client
Server
Session Info
Session
thread
Client
Connection
initial connection
execute request
thread
thread
Connection Pool
Session management
Cookies
thread
SilverStream’s Database connections
server/database connections
Database Server
Client
Database Server
Client
SilverStream
Server
Database Server
Client
Database Connections and performance
prefetch buffers
SilverStream and Servlet Support
javax.servlet.
ServletRequest
1
URL Request
service event
Explorer
javax.servlet.
ServletResponse
2
Netscape
3
javax.servlet.
ServletResponse
HTTP Listener
(Servlet)
SilverStream and Page
Management
• Java Presentations
• Dynamic Page Presentations
Data Access and Queries in SilverStream
Oracle Database
Server
Sybase Database
request
Client
DSO
Lotus
Notes
Result
Business Objects and Corba
Objects in SilverStream
Other Features of SilverStream
• SilverStream and E-mail
• SilverStream and JAR(java archive) files
• SilverStream and JavaBeans
SilverStream Security
Load Balancing and Fail-over in SilverStream
In the Distance with SilverStream
Load Balancing
Topics
• Concepts
– What is Load Balancing?
– Why do we need load balancing?
– What is essential for a load balancer?
• Architecture example: Silverstream
• Common Algorithms
• Vendors
Concepts: What is Load
Balancing?
• Evenly distribute network processing,
database access, transactions.
• Example: Clustering
– distribute incoming transactions evenly
– redirect requests
Concepts: Why do we need load
balancing?
• Handling multiple requests, while ensuring
– optimal response time
– quality performance
• The cluster of servers have even workload
and operate at maximum efficiency.
Concepts: What is essential for a
load balancer?
• Retain the state of all servers it is managing.
• Have a good algorithm
efficient load balancing plan
Example of a good load balancing
architecture
(Silverstream) ...
Silverstream Load Balancing
Architecture
Web Server
ISAPI or NSAPI Layer
Dispatcher
HTTP
Load
Balancer
Application
Server
Application
Server
Cache
Manager
Application
Server
Silverstream Load Balancing
Architecture
Web Server
ISAPI or NSAPI Layer
Dispatcher
HTTP
Load
Balancer
Application
Server
Application
Server
Cache
Manager
• Dispatcher
– receives client
requests
– consults load
balancer
Application
Server
Silverstream Load Balancing
Architecture
Web Server
ISAPI or NSAPI Layer
Dispatcher
HTTP
Load
Balancer
Application
Server
Application
Server
Cache
Manager
• Load Balancer
– the process to:
maintain a state of
all servers; come up
with a balancing
plan
Application
Server
Silverstream Load Balancing
Architecture
Web Server
ISAPI or NSAPI Layer
Dispatcher
HTTP
Load
Balancer
Application
Server
Application
Server
• Cache Manager
– immediately update the
cache
– send invalidation
commands (parallel)
– able to assume all servers
Cache
Manager
Application
Server
Common Algorithms
• Sender Initiated Algorithms
• Receiver Initiated Algorithms (more effective)
• Symmetrically Initiated Algorithms
• Adaptive Algorithms
Some Vendors
• Alteon networks Inc.: ACEswitch
• ArrowPoint Communications Inc. Content
Smart Switch
• Coyote Point Systems Inc.: Equalizer