Client Server Architecture PDF
Client Server Architecture PDF
Key concepts:
Client Server
request
service
- The client and server parts may reside on the same node or on
different nodes
- A part can play the roles of a server of a service and a client of an
another service at the same time
- A client can be connected to several servers
Functional requirements in the 2-tier structures
- Presentation Services
user interface, dialog control
- Presentation Logic
user interaction, simple validation
- Business Logic
control flow
- Distribution Services
communication management
- Database Logic
integrity, data manipulations
- Database Services
security, transaction management
- File Services
file sharing
DESKTOP HOST
Data Logic
Client Server Distribution
Business Logic
File Services
DESKTOP Presentation
Client Business Logic
Data Logic
Functional distribution in the 2-tier structures
Client Server
Presentation Data services
Business logic File services
Data logic
Client Server
Presentation Business logic
Data logic
Data & file services
Client Server
Presentation Business logic
Business logic Data logic
Data logic Data & file services
Implementation of Business Logic at the Server
Trigger:
stored DBMS procedures that are executed when there is change in
database.
- triggering event
- response
It is stored in the DBMS
Centralized management and access control
Oracle SQL:
CREATE TRIGGER name AFTER | BEFORE INSERT |
UPDATE | DELETE ON table FOR EACH ROW
BEGIN
PL/SQL block
END
Stored procedures:
collection of SQL statements and procedural language statements
that control the flow of the procedure
It is stored in the DBMS
Centralized management and access control
Transactions
Logical unit of data processing operations
- Atomicity
- Consistency
- Isolation
- Durability
OLTP
On-Line Transaction Processing
Characteristics:
- Short time transactions
- Several concurrent transactions
- Read-write transactions
- Database stores the actual state of the problem domain
- Vendor independence
- Application portability
- Distribution transparency
- Modularity
- Scalability
- Reliability
- Reconfigurability
- Monitoring
Benefits and Limitations of 2-tier Client/Server Architecture
Benefits
- Interoperability
- Portability
- Integration
- Transparency
- Security
Limits
- The client and server are tightly coupled, the client should use the
interface protocol of the server.
- Network traffic is handled less efficiently, because it clients have
a direct connection to the server.
- The network traffic increases significantly when high volumes of
data and messages are shipped on the network.
- Asynchronous activity. - when a request is sent and an immediate
reply is not required - is not supported.
- The connections are limited to a single resource per transaction.
- The application administration is difficult.
- One cannot tune the response times and there is no capability to
perform load balancing
- The resources are scaled on the number of connected users not on
the throughput
- It consumes many operating system processes and network
connections in order to support a given set of users
The 3-tier Structures
network
application
server
client
DB
database server
Usual distribution:
1. tier: Presentation logic, lite client
2. tier: Business logic, application server
3. tier: Database logic, database server
network
WEB
server
WEB
browser
DB
database server
The WEB servers can access the databases through CGI interface
Middleware
An integrating resource between the clients and servers. It performs
the following main activities:
- translation between the different protocols
- optimization of the load-balancing
- security control
- management of the connections
Server
Client
Middleware
..
Client Server
Client Middleware DB
Control module Server
Service Service
A X
software pipelining:
A service processes only a part of the request and forwards it to an
another service for further processing. If the first service will be
free it can start to process the next request waiting for it. Thus the
requests are processed in a pipeline. If the request does not need
further processing steps, the actual service will return the result to
the client. A request will touch several services.
Control Module and Control Data
Security
It provides application service authentication , authorization and
access control through an architected secury interface. The
interface usually abstracts the Kerberos security model and allows
the security systems to be integrated with the application. Access
control lists may be used to protect services, queues, or events
from unauthorized access.
Database Middleware
The two main services of the database middleware are the data
management and the distribution services.
Distribution Service
This service provides distribution or database location
transparency for the applications. It unburden programmers from
needing to know where applications and data are stored. The
programmer has only to give the object name.
The real position of the object is determined by the directory
service. The directory service keeps track of real addresses of the
alias names. This enables scaling of applications by relocating
logic or databases onto more powerful machines.
Server
Rel. A
Client
Database T(Q(A))
Q(A),Q(B) Middleware
T'(Q(B)) Server
Rel. B
Transaction Processing and Integration Middleware
Transaction processing
The transaction processing (TP) is the automated, interactive
processing of transactions to update the a shared database. A
typical TP application features many end users interacting
concurrently with a system to process business transactions.
trans:
Client
update B Oracle
update A Rel. A
Client
Transaction
Processing and
trans: Integration
Middleware
update A Sybase
update B Rel. B
Transaction Processing Monitors
Transaction at Client
Op.1 Op.2 Op.n
Global transaction
TM
Local transaction
Server A Server B
Op.2 Op.1 Op.3
Transactional RPC :
RPC's that carry transaction contexts along with their messages and
data, and that provide the exactly once invocation semantics
required for reliable distributed communications. It is extension
with transactional syntax.
Performance Issues in TM
Service B
Caching:
When a client application reads a database record, the DBMS
executes an I/O to read that record from the shared database. When
the I/O completes, the DBMS retains a copy of the record in
memory. If any other application requests the record it can be
simply forwarded from memory and does not need to do an I/O.
Pinging:
The same database record is updated at different sites, servers after
each other. Updated records that are released to another server
must first be removed or "flushed" from memory, as it is not
ensured that this value in memory remains the actual value in the
database due to the other server.
When pinging occurs frequently it can significantly reduce the
OPS cache hit rate and overall system performance.
LifeKeeper:
is a software product that monitors two or more servers, detects
server failures, and automatically restarts failed applications on an
alternative server.
Because of its distributed service location transparency, the
Transaction Monitor can route requests accordingly if LifeKeeper
restarts failed applications on a different server.
TM
Server Server
A C
Repository:
a special database of information about engineered artifacts, that
holds the description of objects stored in normal databases
Repository manager
Database manager
Content of repositories:
- database objects definitions
- documents
- source code
- type definitions
- interface definitions
Menus
Forms
Repository
Reports
DB designer
Projects
- repository manager
- browser
- information model
- scripting language
- data import and export utilities
TM Interface:
The TM Interface translates the TM APIs into DBMS native calls
accessible to the 4GL developer. The developed applications
benefit from the 4GL tools - provided features like GUI controls,
modal and modeless windows.
TM Generator:
This reads TM distributed services information and generates
DBMS 4GL objects. Once a service is selected, the default 4GL
modules are generated with objects corresponding to the TM
distributed service input and output parameters. The developer can
personalize the generated 4GL modules using the standard 4GL
components.
Conventional API of TEXUDO
Library-based interface:
Library-based programming is supported via a set of 3GL (like C,
Cobol) procedures. The set of these procedures is called as
Application to Transaction Manager Interface (ATMI).ATMI is a
superset of the X/Open's XATMI interface.
Language-based interface:
The language-based programming is a remote procedure call
(RPC) facility called TxRPC. TxRPC defines a transactional
extension to the OSF's DCE RPC.
Communication Models
{ tpinit(NULL);
data1 = tpalloc(BUFTYPE, SUBTYPE, len);
tpbegin();
tpcall('DEPOSIT', data1, 0, &data1, &len, 0);
tpcall('WITHDRAW', data1, 0, &data1, &len, 0);
tpcommit(0);
tpterm(); }
{ tpbegin();
handle1 = tpacall("withdraw', );
handle2 = tpacall('deposit'..); //parallel execution of services .
tpgetrply(&hand1,&r1 );
tpgetrply(&hand2,&r2 );
tpcommit(); tpterm(); }
Language based (IDL) request/response mode
It is based on TxRPC
RPC : remote procedure call, it uses function call formalism
The requested function code is located on a remote node and the
execution is performed on that remote node.
It can be only synchronous. The client suspends its execution until
the result is received.
{ tx_begin();
ret1 = withdraw(account1, amount1, &balance);
ret2 = deposit (account2, amount2, &balance);
if (ret1 == SUCCESS && ret2 = SUCCESS)
tx_commit; else tx_rollback(); }
Software pipelining
The requested service (function) may perform only a subpart of the
work requested by the client. In this case, it sends a request to an
another service t complete the task.
Example
client site:
tpsetunsol (atm_handle);
// it tells the server to invoke the atm_handle function when an
unsolicited message arrives
server side:
the VALIDATE service
validate(R * reques){
data = request->data;
if (check(data.id) == SUCCESS) {
tpforward('CUST_STATUS',data, );
} else {
// notify the consol about the failure
tpnotify(consol, data,FLAG,..);
raise_failure(..);
tpreturn(failure,..);
}
Store and forward message queuing mode
based on the following functions
- tpenqueue() : place a message into the queue
- tpdequeue() : take a message out of the queue
It can be used in cases when the partners can not communicate with
each other in on-line way. The message is stored in a queue until it
can be processed.