Client-Server Architecture

Backend developer
CodeX
Published in
6 min readAug 11, 2021
Photo by Clay Banks on Unsplash

This article is related to my previous post which was about Architectures in Distributed System. Through this article, I would like to share basic concepts of client-server model. As I have mentioned in my previous post that client-server is one of the architectures in Distributed System but it is not common in web applications these days. Peer-to-Peer has gained more admiration and acceptance. So, let us now discuss more about client-server model and its usage.

Client–Server model is a distributed application structure that divides tasks or workloads between the providers of a resource or service, called Servers, and service requesters, called Clients. Applications that make use of the client–server architecture are email, network printing, World Wide Web and many more.

Client-Server model

The server is where all the essential processing takes place, while at the client, the user can access the services provided by the server. Mostly, there is only one server that is on the remote side, but for security and efficiency we use multiple servers, which use load balancing techniques.

Load Balancing is very important in designing reliable architecture. It helps in distributing networking traffics across multiple servers to improve application responsiveness and avoid traffic cohesion. We will discuss more about load balancing algorithms and techniques in upcoming posts.

Now, to understand the communication between client and server, we need to understand the below terminologies properly :

  • Requests: Requests are sent from the client in order to ask the server for some data such as files, or to inform the server about activity that is happening, such as a user wants to login with his credentials.
  • Response: A response is sent from the server to the client and is the reaction of the server to a request of the client. For example, an authentication result.
  • Service: A Service is a specific task that the server provides for the client to use, such as downloading image

Moreover, a single computer can run web server and file server software at the same time to serve different data to different clients making different kinds of requests.

Client and Server Communication

Clients and servers exchange messages in a request–response messaging pattern. The client sends a request, and the server returns a response to received request. This exchange of messages is a classic example of inter-process communication. A server component continuously listens for requests from client components. When a request is received, the server processes that request, and then sends a response back to the client. Servers may be further classified as stateless server or stateful server.

  • A Stateful server remembers client data (state) from one request to the next. These servers store session state. Moreover, they keep track of which clients have opened which files, current read and write pointers on files, which files have been locked by which clients, etc.
  • A Stateless server keeps no state information. These servers do not store any session state. This means that every client request is treated independently, and is not a part of a new or existing session.

In order to simultaneously process requests from multiple clients, a server frequently uses the Master-Slave Pattern. In this case the Master continuously listens for client requests. When a request is received, the master creates a slave to process that request, and then resumes listening again. At the same time, the slave performs all subsequent communication with the client.

The below sequence diagram clearly explains a typical client-server interaction :

How the browser generally interacts with the servers?

  • User enters the URL(Uniform Resource Locator) of the website or file. The Browser then requests the DNS(Domain Name System) Server.
  • DNS Server lookup for the address of the Web Server.
  • DNS Server responds with the IP address of the Web Server.
  • Browser sends over an HTTP/HTTPS request to Web Server’s IP (provided by DNS Server).
  • Server sends over the necessary files of the website.
  • Browser then renders the files and the website is displayed. This rendering is done with the help of DOM (Document Object Model) interpreter, CSS interpreter and JS Engine collectively known as the JIT or (Just in Time) Compilers.

Advantages of Client-Server model

  1. Centralization — The main advantage of client-server network is the centralized control. All the necessary information are placed in a single location. This is especially beneficial for the network administrator since they have the full control over management and administration. Whatever the problem that occurs in the entire network can be solved at one place. Also due to this, the work of updating resources and data has become effortless.
  2. Security — In client-server network, the data is well protected due to its centralized architecture. It can be enforced with access controls such that only authorized users are granted access. One such method is imposing credentials such as username and password. Also, if the data is lost, the files can be easily recovered from a single backup.
  3. Scalability — Client-Server networks are highly scalable. Whenever users need they can increase the number of resources such as clients and servers. Thus, increasing the size of the server without much interruptions. Even if the size gets increased, there is no hesitation about permission to network resources since the server is centralized. Therefore, very less number of staffs are required for the configurations.
  4. Management — Since all the files are stored in the central server, it is easy to manage files. Client-Server network can easily track and find records of required files.
  5. Accessibility — Irrespective of the location or the platform, every client is provided with the opportunity to log into the system. By this way all the users will be able to access their corporate information without needing to use a terminal mode or a processor.

Disadvantages of Client-Server model

  1. Traffic Congestion — The primary disadvantage of client server network is the traffic congestion. If too many clients make request from the same server, it will result in crashes or slowing down of the connection. An overloaded server may create many problems in accessing information.
  2. Robustness — As we already know that client server networks are centralized. In case if the main server happens to undergo failure or interference, then the whole network will be disrupted. Therefore, client server networks lack robustness.
  3. Cost — Sometimes the setting up and maintaining the server is expensive in client server network. Since the networks are powerful they can be expensive to purchase. Hence, all the users will not be able to afford them.
  4. Maintenance — When the servers are implemented, they generally work non-stop. This means that proper attention must be given to each server. If there are any problems, it must be resolved immediately without any delay. Hence, there should be a specialized network manager appointed to maintain the server.

These findings were taken from various verified resources. Please feel free to review or correct the details mentioned in this post. We will discuss more about other architectures and their usage in next posts. Unfortunately, I was not able to cover everything here. Stay tuned. Happy Learning! :)

--

--