Client-Server Interaction

Download Report

Transcript Client-Server Interaction

Client-Server Interaction
Based on Appendix 1 in
Computer Networks and
Internets, Comer
CSIT 320 (Blum)
1
Network Applications




All of the lower layers of the network communication
protocol stack exist so that applications on different
computers can interact.
Applications are high-level software used directly by
users.
The applications (e.g. Excel) sit on top of the
application layer which provides various networkrelated services (e.g. FTP) to the applications.
The basic paradigm for this application-to-application
interaction on an internet is the client-server model.
CSIT 320 (Blum)
2
Application Software

Applications and the application layer hide all of the
details of the network from the user.
•


Information hiding
In most cases the user does not have to know the IP
address (let alone the MAC address) of the computer
he or she is communicating with.
The application provides a user-friendly symbolic
name, which is then translated into the
corresponding number.
•
E.g. a domain name service
CSIT 320 (Blum)
3
Connection-Oriented




While TCP is in part responsible for establishing a
session between two computers, the TCP does not
establish a connection on its own volition.
The source application layer must direct its transport
layer to do so.
The destination application layer must direct its transport
layer to “listen for” others trying to connect to it.
In the phone analogy, the source must dial the number,
the destination must hear the phone ring and answer it.
CSIT 320 (Blum)
4
The client-server paradigm

The approach in which the source initiates
contact with a listening destination is said to
adhere to the client-server paradigm.

The initiating source is called the client.
• Clients are “active.”

The listening destination is called the server.
• Servers are “passive.”
CSIT 320 (Blum)
5
Two meanings

In one sense, client-server is used to refer to
the communication model
•
•

Client: Active requester
Server: Passive listener/responder
In another sense, client-server is used to refer
to machines which are designed to act as
clients or as (dedicated) servers
•
In this sense, a server is a machine capable of offering
a such service to a number of clients.
CSIT 320 (Blum)
6
What is a Server?



A server can refer to a program that passively
waits for communication.
A server can refer to a computer dedicated to
running server programs.
Sometimes the term “server class computer” is
used for the latter case.
•
•
But most of the world uses the term “server” in both
cases.
Servers or server-class computers are typically
powerful machines which run server software.
CSIT 320 (Blum)
7
Not the only paradigm in town

Client-server is not the only model for
computer-to-computer communication.
• Peer-to-peer: A type of network in which each
workstation has equivalent capabilities and
responsibilities. Peer-to-peer networks are generally
simpler, but they usually do not offer the same
performance under heavy loads.
• Master/slave: master polls the slaves to see if they
have anything to transmit.
CSIT 320 (Blum)
8
Mainframe architecture




Mainframes are an example of the masterslave model.
Most of the data storage and computing power
lies in the mainframe (a central computer).
Users interact with the mainframe via terminals
(“dumb terminals”) which is little more than a
monitor and keyboard.
In the early days of PCs, they were often
disabled to work as dumb terminals in a
mainframe.
CSIT 320 (Blum)
9
Thin and fat clients

There was an idea of returning to some extent to the
notion of a dumb terminal.

In client/server applications, a client designed to be
especially small so that the bulk of the data processing
occurs on the server is called a thin client.

A client that performs the bulk of the data processing
operations is called a fat client.

Although the term usually refers to software, it can also
apply to a relative abilities of a network computer.
CSIT 320 (Blum)
10
Client/Server Operating Systems

Often the version of the operating
system one loads on a computer that
mainly plays the client role will be
different from the version of the
operating system loaded on the server
• E.g. Windows 7 is different from Windows
2008 Server
CSIT 320 (Blum)
11
The client

Client software
•
•
•
•
•
•
Requests service but also performs its own computations.
Is invoked directly by a user and executes only for one
session
• as opposed to starting automatically and running continuously
Usually runs locally on a user’s PC
Initiates contact with a server.
May access multiple services, but only communicates with
one server at a time.
Does not require special hardware (beyond standard
communications hardware) or Operating System.
CSIT 320 (Blum)
12
The Server

Server software
•
•
•
•
•
•
Is a special-purpose, privileged program dedicated to
providing one service.
Can handle multiple remote clients at the same time.
Is invoked automatically (typically when a system boots)
and continues to execute through many sessions.
Waits passively for contact from arbitrary remote clients.
Accepts contact from arbitrary clients, but offers a single
service.
Requires powerful hardware and a sophisticated operating
systems.
CSIT 320 (Blum)
13
Application Software

Applications (as opposed to services
provided by the application layer) that
communicate with other applications are
often written with either the client role or
server role specifically in mind.

Thus one talks about “client-side
scripting” and “server-side scripting.”
CSIT 320 (Blum)
14
Scripting

Client-side scripting is code written for the client
end of a client-server system.
•

Server-side scripting is code written for the
server end of a client-server system.
•

For example, JavaScript scripts are client-side
because they are executed by your browser (the
client).
For example, PHP scripts are server-side because
they run on the Web server.
Java applets can be either server-side or clientside depending on which computer (the server
or the client) executes them.
CSIT 320 (Blum)
15
Client-Server Interaction





Information between client-server passes in both
directions.
Clients request, servers respond.
Sometimes the server’s response is an ongoing
communication based on one initial request.
Client-server applications lead the protocol suite
to establish the session and send/receive
information.
A computer needs all stacks of the software
protocol suite to run as a client or server.
CSIT 320 (Blum)
16
Client-Server
CSIT 320 (Blum)
17
One connection/Many services

A computer with multiple servers still requires only a
single physical connection for communication.
•

Since servers are often in passive modes, having one
computer offer many services can help reduce
administrative overhead and cost without a significant
reduction in performance.
•

Different services will be associated with different ports.
Virtualization
However, if many clients are expected for a particular
service it may be worthwhile having a machine
dedicated to it.
CSIT 320 (Blum)
18
Some Server Types

A file server is a computer and storage device
dedicated to storing files. Any user on the network
can store files on the server.

A print server is a computer that manages one or
more printers.

A network server is a computer that manages
network traffic.

A database server is a computer system that
processes database queries.
CSIT 320 (Blum)
19
Multiple services
CSIT 320 (Blum)
20
A thread for each request




In order to handle concurrency, that is, dealing with
many clients at once, the server-class computer uses
“threads.”
Certain services being associated with well-known
ports.
Actually the main thread or listener (usually a daemon)
is located at this port, but as soon as a request is made,
a new thread is spun off (forked) for it.
This allows the main listening thread to await the next
client.
CSIT 320 (Blum)
21
Thread

A thread is the information needed to serve
one individual user or a particular service
request.

If multiple users are using the program or
concurrent requests from other programs
occur, a thread is created and maintained for
each of them.
CSIT 320 (Blum)
22
Types of Transport Protocols

The application services may be
connection-oriented or connectionless.

Connection-Oriented
• The applications must first establish the
connection and then send the data across the
connection. TCP requests the connection
and once established the communication
begins. Session must be terminated.
CSIT 320 (Blum)
23
Types of Transport Protocols

Connectionless Interface
• The application sends a message to the destination
at any time. The sending application needs to
specify the destination with each message sends.
The UDP is the connectionless support mechanism
in the TCP/IP protocol.
• For a client request using the connectionless
interface, servers often require the request to be sent
in a single message. The server responds in a single
message.
CSIT 320 (Blum)
24
Service Connections Choice



Servers may provide a service through both connection
methods.
The choice of transport is dependent on the client.
This choice requires the server to provide both transport
implementations. This may be implemented by
•
•
Setting up 2 servers for the same service, one for
connectionless transport and one for connection-oriented
transport.
Setting up a single server that is able to interact with
either type of transport protocol simultaneously.
CSIT 320 (Blum)
25
Client-Server Interactions



A client application is not restricted to accessing
a single service. A single application can
become the client of several servers over time.
A client application is not restricted to accessing
a single server for a given service. A client might
send a request to multiple servers to improve
performance.
A server is not restricted from performing further
client-server interactions . A server for one
service can become a client of another.
CSIT 320 (Blum)
26
Two-tier


The term two-tier refers to client/server
architectures in which the user interface
runs on the client and the database is
stored on the server.
The actual application logic can run on
either the client or the server.
CSIT 320 (Blum)
27
Three tier

A special type of client/server architecture consisting
of three well-defined and separate processes, each
running on a different platform:
1.
The user interface, which runs on the user's computer (the
client).
2.
The functional modules (business rules) that actually
process data. This middle tier runs on a server and is often
called the application server.
3.
A database management system (DBMS) that stores the
data required by the middle tier. This tier runs on a second
server called the database server.
CSIT 320 (Blum)
28
Three tier (Cont.)

The three-tier design has many advantages
over traditional two-tier or single-tier designs,
mainly:
•
•
The added modularity makes it easier to modify or
replace one tier without affecting the other tiers.
(Remember Layering and information hiding.)
Separating the application functions from the database
functions makes it easier to implement load balancing,
i.e. spreading the processing out
CSIT 320 (Blum)
29
References



Computer Networks and Internets,
Comer
http://www.whatis.com
http://www.webopedia.com
CSIT 320 (Blum)
30