Overview

advertisement
Client Server Paradigm
Objectives:
 Taxonomy of distributed systems
service models point of view
 Client-server architecture




Thin versus thick clients
Two and three tier architectures
Tradeoffs between these different
architectures
 Software Architectures for Clients and
Servers
1-1
Distributed Systems:
Service-models Taxonomy
 Centralized model
 Client-server model
 Cluster-based model
 Grid-based model
 Peer-to-peer model
1-2
Distributed Systems:
Service-models Taxonomy
 Centralized model
 This the classic
mainframe time-sharing
system
 The computer may
contain more than one
CPU
 Terminals have serial
connections
 Drawbacks
 Single-point of failure
 Not scalable
 Resource contention
 Are there any
advantages?
1-3
Distributed Systems:
Service-models Taxonomy
 Client-server model
 A networked model
consisting of three
components
• Server
• Client
• Service

The labels client and
server are within the
context of a particular
service
 Advantages?
 Disadvantages?

The labels client and
server are within the
context of a particular
service
1-4
Distributed Systems:
Service-models Taxonomy
 Cluster-based model
 Tightly-coupled
 Closely linked via LAN networking
 Grid-based model
 Focuses on the ability to support computation across
administrative domains
 Peer-to-peer model
 Example: Gnutella, Kazaa
 Peers are intermittently connected and change IP
addresses
1-5
Distributed Systems: comparison
paradigm
node
ownership
node
management
controlling
policies
discovery
mechanisms
peer-to-peer
computing
local
local
none
centralized
or
distributed
Cluster
computing
global (single
ownership)
global
global job
scheduling
Grid
computing
local
global
management
under local
policies
single
controlling
policy
centralized
or
distributed
 Where does a client server computing fit?
1-6
Client Server Architecture
 It is way of designing an application in which clients
contact well-known servers to access resources
 What fraction of the task do clients process
before giving the work to the server?

Thin clients
• Clients are information appliances
• Servers are resource-rich
• Must have a resource-rich connectivity

Thick clients
• Clients perform the bulk of data processing operations
• Servers perform rudimentary tasks

Trade-offs between thin and thick clients?
1-7
Two-tier Client Server Architecture
 Traditional client-server
architecture
 A good solution for
small-scale group sizes
 This architecture has
limitations
• Does not scale
• Restricts flexibility
– Moving or
repartitioning
program
functionalities
1-8
Multi-tier Client Server Architectures
 Example: three-tier
architecture
 The three-tier design
has many advantages
over traditional twotier
• Added modularity
• Function isolation
• Scalability
1-9
Client-server system architecture
vs.
Client-server distributed computing
 In the client-server system architecture,
the terms clients and servers refer to
computers
 In the client-server distributed computing
paradigm, the terms refer to processes
1-10
Client-server, an overloaded term
client hosts
service request
a client process
a server process
server host
Server host
a service
...
...
Client host
The Client-Server Paradigm, conceptual
Client-Server Computing Paradigm
Client-Server System Architecture
Client hosts make use of services
provided on a server host.
Client processes (objects) make use of a service
provided by a server process (object) running on
a server host.
1-11
Client-server system The interprocess
communications and event synchronization
 Typically, the interaction of the client and server
processes follows a request-response pattern.
server
client
request1
response 1
request2
response 2
requestn
response n
1-12
Software Architectures for Clients and
Servers
 The Software architecture of client-server application
consists of



Presentation layer
Application layer
Service layer
client-side software
presentation logic
application logic
service logic
server-side software
application logic
service logic
 Any client-server software must have the
three-layer functionalities
 Is this a good approach? Why?
1-13
Software Architectures for Clients and
Servers: Example
 We will look at a Daytime client-server software
Daytime service [RFC867]:
Client: Hello, <client address> here.
May I have a timestamp please.
Server: Here it is: (time stamp
follows)
1-14
1-15
1-16
1-17
Software Architectures for Clients and
Servers: Separating the layers
 Allows each module to be developed by
appropriate people
 People have different skills
 Allows modifications to be made in isolation
1-18
Client-Server Paradigm Issues
 A service session
Same service might be requested by multiple
clients
 Client sessions need to be kept separated and
isolated
 The service protocol




How the service is to be located
The sequence of the IPC
Data syntax and semantics
 IPC and event synchronization
1-19
Testing a Network Service
 Since network software is notoriously difficult to
test





Use the three-layered software architecture and
modularize each layer on both the client and the server
Use an incremental or stepwise approach in developing
each module
Develop the client first
Test the client independent of the server
Test the client-server suite on one machine before
running the programs on separate machine
1-20
Client-Server Paradigm: Server Types
 Connection-oriented server
 Connectionless-oriented servers
 Iterative servers
 Concurrent servers
 Stateful servers
 Stateless serves
1-21
Client-Server Paradigm: Server Types
 Connection-oriented server
 Connectionless-oriented servers
 Iterative servers
 Concurrent servers
 Stateful servers
 Stateless serves
We will look at the tradeoffs of these different
server types
1-22
Connection-oriented communication
 A separate connection is maintained for each
session
 Once the connection is established, data can
be sent until the session is over
 The connection needs to be explicitly torn
down
 Imagine that we have n processes


What happens if a connection is established between
a sender and every other process?
What happens if all the n processes is a sender?
Connection-oriented servers rely on
connection-oriented communication
1-23
Connection-oriented: Daytime Server
Example
…
theServer = new ServerSocket(thePort);
p = new PrintWriter(System.out);
try {
p.println("Echo Server now in business on port "
+ thePort );
p.flush();
Connection acceptance
theConnection = theServer.accept();
// read a line from the client
theInputStream = new BufferedReader
(new InputStreamReader (theConnection.getInputStream()));
p = new PrintWriter(theConnection.getOutputStream());
while (!done){
theLine = theInputStream.readLine();
if (theLine == null) done = true;
Protocol processing
else{
p.println(theLine);
p.flush();
}
}
theConnection.close();
1-24
Connectionless-oriented communications
 Involves no connection
 Packets are explicitly addressed by the sender
 The connection needs to be explicitly torn
down
 Connectionless communications are simpler to
provide
 Packets can be delivered out of order
Connectionless-oriented servers rely on
connectionless-oriented communication
1-25
Iterative Servers
 An iterative server in unable to overlap client
sessions
 Is a connection-oriented server an iterative
server? If yes, why?
 Suppose that n clients have requested
connection at a given time, and each session is
expected to last t time units. What will happen
to request n+1?
 What is the solution???
1-26
Concurrent Servers
 A concurrent server in capable of conducting
multiple client sessions at once
 A concurrent server can be provided by using


Threads or
Asynchronous IPC operations
1-27
Stateful servers
 A stateful server maintain stateful information
on each active client
 Stateful information can reduce the data
exchanged, and thereby the response time
FTP se rve r
FTP se rve r
FTP Clie nt
FTP Clie nt
file ID
file ID file position
file position
GET file name
file ID
send <file ID>, block 0
data from block 0 of file
send <file ID>, block 1
data from block 1 of file
...
GET file name
ready
send next block
data from block 0 of file
send next block
data from block 1 of file
...
1-28
Stateful vs. Stateless server
 Stateless server is straightforward to code, but the
state information maintained by the server can reduce
the data exchanged
 Are there any problems with stateful servers?
FTP se rve r
FTP Clie nt
file ID file position
GET file name
ready
send next block
data from block 0 of file
send next block
data from block 1 of file
...
data is lost due to network failure
client resubmits request
client receives data as block 0 of file;
the true block 0 is missed.
1-29
Stateful vs. stateless server
In actual implementation, a server may be



Stateless
Stateful
A hybrid, wherein the state data is distributed on both
the server-side and the client-side
Which type of server is chosen is a design issue
1-30
Global state information
 Information maintained by a server for all the
clients throughout the lifetime of a service
 The global state information needs to be
synchronized for mutual exclusion
1-31
Session state information
 Information maintained specific to a client
session
 Two schemes to maintain session information

Session information maintained by the client
• The server processes each request in the same manner
• The complexity of the server’s application logic is
reduced
• Such a server is called stateless

Session information maintained by the server
• Server keeps track of the session progress of the client
• Server is more complex to design and implement
• Failure provisions
1-32
Summary
 You have been introduced to the client-server
paradigm in distributed computing. Topics covered
include



The difference between the client-server system
architecture and the client-server distributed computing
paradigm
Definition of the paradigm and why it is widely adopted in
network services and network applications
The issues of service sessions, protocols, service location,
interprocess communications, data representation, and
event synchronization in the context of the client-server
paradigm
1-33
Summary: Con.
 The three-tier software architecture of network




applications: Presentation logic, application logic,
and service logic
Connectionless server versus connection-oriented
server
Iterative server versus concurrent server and the
effect on a client session
Stateful server versus stateless server
In the case of a stateful server: global state
information versus session state information
1-34
Summary: Con.
 You are required to read the following:
 The paper entitled “A taxonomy of distributed
computing”
 Chapter 5 of the Distributed Computing book
 Chapter 2 of the Distributed Computing book
1-35
Download