Вы находитесь на странице: 1из 8

Computer Science Program, The University of Texas, Dallas

Client-Server Architecture
Clients and Servers Client/Server with File Servers Client/Server with Database Servers Client/Server Communication Client/Server with Transaction Processing Client/Server Groupware Web Client/Server

Lawrence Chung

Paradigm Shift: Past, Present and Future W Centralized processing


A host computer (often a mainframe) handls all processing, including input, output, data storage and retrieval
                          

W Distributed processing
A number of computers (minis, workstations, PCs, ...) handle all processing, They are distributed physically and connected thru a communications network

W Cooperative processing
A number of computers (minis, workstations, PCs, ...) handle all processing, They are distributed physically and connected thru a communications network Processing thru sharing of resources, transparently to the users

Lawrence Chung

Clients and Servers v


Basic Definition 3 Client: requests for services 3 Server: provides services 2 Service: any resource
(e.g., data, type defn, file, control, object, CPU time, display device, etc.)

Typical Properties u A service request is about "what" is needed, and it often made abstractly
It is up to the server to determine how to get the job done -> the notion of module (cf. MILs, ADTs --- Larch, Z)

u The ideal client/server software is independent of hardware or OS platform u The location of clients and servers are usually transparent to the user u A client may become a server; a server may become a client u A client/server system can be scaled
horizontally, i.e., by adding/removing client workstations with only a slight performance impact vertically, i.e., by migrating to a larger and faster server machines or multiservers

Lawrence Chung

Client/Server with File Servers

Client Application

Client Application

Client Application

Centralized
File Server

3 3 3 3

The client passes requests to the file server (software) for file records Clients can reside in the same machine or separate machines (typically PCs) Requests can be either local or over a network Indispensable for documents, images, drawings, and other large data objects Client Application Client Application Client Application

Distributed
File Server

Network

File Server

Lawrence Chung

Client/Server with Database Servers

Client Application

Client Application

Client Application

insert/update/delete tuple(s)

Network

Database Server

3 At present the majority of existing client/server-based software is to be found in the area of


databases, and it is here that the greatest challenge to any corporation currently lies. [Richard Finkelstein, President, Performance Computing]

Events (violation of integrity constraints, temporal conditions, errors) trigger event handlers -> implicit invocation, blackboards, events

3 A DBMS also offers features for recovery and concurrency control


C C C ' # B A @ 9 ' ( & a " ` 8 2 1 ' 7 T 6 5 " 6 4 3 2 1 ' & ( # T 0 ) ( ' & a % $ @ V U # D U " !

Lawrence Chung

Client/Server Communication
Sockets -> RPCs -> MOMs and ORBs

 Sockets
3 introduced in 1981 as the Unix BSD 4.2 generic interface 3 provide Unix-to-Unix communications over networks 3 The Windows socket API (Winsock): based on the Unix BSD 4.2 sockets interface
Net_id.Host_id

Internet Address
" 4 I ' G 6 F B ( 4 H & % A B % @ 5 ' G 6 F B & E & 6 2 @

Port Address
R B ( 4 Q y t a W p y V x U a g U v x a w a t U y a a W t w p t a V W a U W p g V p v U V u g U ` g v u # v a u U a 2 T ` 4 d Y Y U ( T Y Y s W 2 ` ` % d Y f p W A V r X A U ` # d T d U 4 d B i a i U ( ` U B X Y W ` ` 2 Y X 6 f d V ` 4 ` ` Y d ` A ` f V a v ) r p a " h Y V B a U g ` ` U T V X 2 Y T p & Y V ` f P Y t V ` U ` p h U ( a W Y V p B W T b a e U V U U ` X T U

3 Principal transport service calls


Socket (addr format, type: connection-oriented/connectionless, protocol:TCP/IP/...)
b U V a W t a W d U Y T d U s ` f d c X U Y ` b X a W W V Y T ` X ` ` T V ` T t a s a T ` S p X U a ` a V T ` U a Y Y U U f V b ` X V T ` ` r T X Y X ` X b X X X Y X ` ` ` X X ` ` e Y e W W p Y Y W X V i X ` X W b ` Y V a b ` ` T d W ` d ` d ` T ` a q q q S

Bind(...)

Listen(...)
b ` d X Y W a U W Y V

Accept(...)

Connect(local_socket, remote_socket) Shutdown(local_socket, remote_socket) Send(local_socket, remote_socket, buffer, bytes) Recv(local_socket, remote_socket, buffer, bytes) Select(...)
Lawrence Chung
s W ` T U Y Y ` p V U a ` e U t X f d Y ` t T a ` e U t X f d Y X U a U W Y V ` a a U

Client/Server Communication
Sockets -> RPCs -> MOMs and ORBs

RPCs (Remote Procedure Calls)


3 a transparent mechanism to give the client procedure the illusion that
it is making a direct call on the distant server procedure stubs: 3 local procedures (e.g., read(file_id, buffer, count)) hiding details of network comm.

3 10 steps to execute a RPC


Client prog/proc 10. result unmarshalling
(unpack the msg into result)

Server prog/proc 5. parameter unmarshalling


(unpack the msg into parameters); server proc call

1. stub call

6. server proc returns

Client stub 2. parameter marshalling


(collect & pack the parameters into a msg); a sys call

Server stub 4. pass the msg 7. result marshalling


(pack the result into a msg); a sys call

9. pass the msg

3. send the call msg Transport entity 8. send the return msg
Lawrence Chung

Transport entity

Client/Server Communication
Sockets -> RPCs -> MOMs and ORBs

MOM (Message-Oriented Middleware) Every DAD (Distributed Application Development) needs a MOM

v
MOM

3
Client

RPC

Many-to-many messaging via queues

Server

Server Client
post office-like asynchronous no fixed sequence a single queue sharable

Server

Client

Lawrence Chung

Client/Server with Transaction Processing

Client Application

Client Application

Client Application

transactions (banking, reservation,...)

Network

TP Monitor

Database Server

Transaction changeAddress (p: String, newAddress: Address) begin oldAddress <- retrieve address from Person where "name = p" if oldAddress = newAddress then return error1 else update Person where "p = name" with address <- newAddress end Transaction increaseSalary (increment: Dollar) begin ... end

Lawrence Chung

Client/Server with Transaction Processing


3 Transactions are a way to make ACID operations a general commodity
[Transaction Processing Concepts and Techniques, Jim Gray and Andreas Reuter, 1993]

Atomicity t a transaction is an indivisible unit of work t an all-or-nothing proposition t all updates to a database, displays on the clients screens, message queues t e.g., salary increase for all 1 million employees or none Consistency t a transaction is an indivisible unit of work t S -> [T | abort] -> S t integrity constraints (e.g., mgr.salaray > salary) Isolation t a transactions behavior not affected by other transactions running concurrently t e.g., reserve a seat t serialization techniques Durability t persistence t a transactions effects are permanent after it commits.
Lawrence Chung
h o j m n e i f e j m k d f e l k e j f i h g g g e d f e d h s f j e g s m f r q p

Client/Server with Transaction Processing v


Two-Phase Commit Protocol

3 To synchronize updates on different machines so that they either all fail or all succeed 3 centralize the decision to commit but giving each participant the right of veto 3 like a Christian marriage
Commit Coordinator (Root)
Phase 1

Subordinate Node Prepare-to-commit

Subordinate Node Prepare-to-commit

Prepare-to-commit

Record in Log

Ready-to-commit

Ready-to-commit

Phase 2

Commit

Commit

Commit

Complete

Complete

Complete

t If the subordinates have spawned pieces of the transaction on other nodes,


they must propagate the prepare-to-commit-command in the first phase -> a transaction tree t If any of the participants returns a transaction failure, the root node tells all its subordinates to perform a rollback
Lawrence Chung

Client/Server Groupware
3 Why?
support for business reengineering: bcfh -> maximize profit change the way people communicate with each other helps manage (and track) the product thru its various phases computer-supported cooperative work (CSCW) collaborative/workgroup computing return on investment: 16% to 1666% on a median investment of $100K [a study of 65 Notes users in 1994] 3 Five foundation technologies

from electronic imaging (scanning, digitization, display, storage and retrieval) to document (component types: text, image, graphics, faxes, mail, voice clips, BBs)

thru microphones, video windows, electronic whiteboards, controlled access to shared document electronic scheduling of meetings, sharing calendars and "to do" lists, triggering events

e Why not just DBMS?


DBMS: highly structured data Groupware: highly unstructured data document database e Why not just TP Monitors? TP Monitors: transaction processes Groupware: (currently) not transaction-oriented in the ACID sense
Lawrence Chung

Client/Server Groupware
g X e U d c c S Y T ` a f X r U `

Form Processing

DB query

e-mail to accountg conferencing

fax

spreadsheet

d Many office workers spend a high percentage of their time processing documents d The "workflow river" carries the flow of work from port to port,
value being added along the way

d The workflow definition must take into consideration: h Routes along which the object moves h Rules about what information is routed and when
E.g., "If the loan is over $100, 000, send it to the supervisor within the next hour or else send it to the next hop"

h Roles define job functions independently of the people who do it


E.g., the "supervisor" role can be handled by users "Adam" and "Eve"
Lawrence Chung

Web Client/Server

1 2 6

3
Internet TCP/IP

4 5

You select a target URL (Univeral Resource Locator - platform-independent naming scheme)

http
Protocol

://www.utdallas.edu :80
Server Address Port Number

:~ttsx19c/java/toys.html
Target Resource Path

2 Brower takes the URL, embeds it inside an HTTP request, and sends it to the server

h HTTP (HyperText Transfer Protocol), a stateless RPC,

is used to retrieve URL-named resources 1) establishes a client/server connection, 2) transmits and receives parameters including a returned file, and 3) breaks the client/server connection STATELESS: a new connection for each user request - simple but inefficient

3 The HTTP server receives the reqest on the port, makes a socket connection, 4 The server finds the requested HTML file (Page Object) and concatenates it with status info

HTML (HyperText Markup Language) describes the structure of a Web document, provide font and graphics info, and define hyperlinks to other Web pages & Internet resources)

5 The server ships back the file, and closes the connection 6 The Browser interprets the HTML command and displays the page content
and invokes a helper application (e.g., xview, audiotool)
Lawrence Chung

W T

Y W h

g i X

d a

q S

Page Object

HTML Documents

Web Client/Server
X ` b i d d W U

3 1
d

Env. Var.

2
Internet TCP/IP
HTTP Srvr

5 4
CGI Prog

6 8

You click on the forms "submit" button The Web browser collects the data within the form, assembles it into a string of name/value pairs, specifies a POST method, the URL of the target program in the "cgi-bin" directory

2 The HTTP server receives the method invocation via a socket connection 3 The server parses the message to discover that its a POST for the "cgi-bin" program
-> start a CGI interaction: The HTTP server sets up the environment variable (e.g., content_length), in a blackboard 4 The HTTP server starts a CGI program

5 The CGI program reads the environment variables 6 The CGI program receives the message body via the input pipe 7 The CGI program does some work, typically by interacting with a DBMS, TP Monitor 8 The CGI program returns the results via the output pipe 9 The HTTP server returns the results to the Web brower
Lawrence Chung

Web Client/Server

Java Applet Bytecode Verifier Class Loader Java Run-time Interpreter

Java Compiler

Just-in-Time Compiler Applet Bytecode

1 5

Internet TCP/IP

2 3

1 A Web browser requests a Java applet

The Browser initiates a separate TCP/IP session to download each applet within a Web page

2 The server retrieves the requested applet 3 The server sends the applet 4 The browser loads the applet into the clients memory and executes it
A poor mans compound document architecture The applets region does NOT visually integrate with the rest of the page

5 The browser deletes the applet from memory when it exits the Web page
Lawrence Chung

Вам также может понравиться