410 likes | 517 Views
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.
E N D
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
Distributed Systems: Service-models Taxonomy • Centralized model • Client-server model • Cluster-based model • Grid-based model • Peer-to-peer model
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?
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
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
Distributed Systems: comparison • Where does a client server computing fit?
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?
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
Multi-tier Client Server Architectures • Example: three-tier architecture • The three-tier design has many advantages over traditional two-tier • Added modularity • Function isolation • Scalability
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
Client-server system The interprocess communications and event synchronization • Typically, the interaction of the client and server processes follows a request-response pattern.
Software Architectures for Clients and Servers • The Software architecture of client-server application consists of • Presentation layer • Application layer • Service layer • Any client-server software must have the three-layer functionalities • Is this a good approach? Why?
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)
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
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
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
Client-Server Paradigm: Server Types • Connection-oriented server • Connectionless-oriented servers • Iterative servers • Concurrent servers • Stateful servers • Stateless serves
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
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
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(); 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; else{ p.println(theLine); p.flush(); } } theConnection.close(); Connection acceptance Protocol processing
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
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???
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
Stateful servers • A stateful server maintain stateful information on each active client • Stateful information can reduce the data exchanged, and thereby the response time
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?
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
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
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
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
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
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