Client-server

In Computer science, **client-server** is a software architecture model consisting of two parts, client systems and server systems, both using a computer network or on the same computer. A client-server application is a distributed system made up of both client and server software. Client server application provide a better way to share the workload. The client process always starts a connection to the server, while the server process always waits for requests from any client. 

When both the client process and server process are running on the same computer, this is called a **single seat** setup.
## P2P
Another type of related software architecture is known as **peer-to-peer**, because each host or application instance can act as both a client and a server (unlike centralized servers of the **client-server** model) and because each has the same responsibilities and status. Peer-to-peer architectures are often abbreviated using the acronym **P2P**.

Both **client-server** and **P2P** architectures are in wide usage today.
## Client-server relationship
The **client-server relationship** describes the relation between the client and how it makes a service request to the server, and how the server can accept these requests, process them, and return the requested information to the client. The interaction between client and server is often described using sequence diagrams. Sequence diagrams are standardized in the Unified Modeling Language.

## Two-tier
The basic type of **client-server** software architecture employs only two types of hosts: clients and servers. This type of architecture is sometimes referred to as **two-tier**. The **two-tier** architecture means that the client acts as one tier and server process acts as the other tier.
## Network computing
The **client-server** software architecture has become one of the basic models of network computing. Many types of applications have been written using the **client-server** model. Standard networked functions such as E-mail exchange, web access and database access, are based on the client-server model. For example, a web browser is a client program at the user computer that may access information at any web server in the world. 

## Clients characteristics
* Always initiates requests to servers.
* Waits for replies.
* Receives replies.
* Usually connects to a small number of servers at one time.
* Usually interacts directly with end-users using any user interface such as graphical user interface.

## Server characteristics
* Always wait for a request from one of the clients.
* Serves clients' requests then replies to the clients with the requested data.
* A server may communicate with other servers in order to serve a client request.
* If additional information is required to process a request (or security is implemented), a server may request additional data (passwords) from a client before processing a request.
* End users typically do not interact directly with a server, but use a client.

## Advantages
* In most cases, a **client-server** architecture enables the worsening of roles and responsibilities of a computing system to be distributed among several independent computers that are known to each other only through a network, so one of advantages of this model is greater ease of maintenance. For example, it is possible to replace, repair, upgrade, or even relocate a server while its clients remain both unaware and unaffected by that change. This independence from change is called **encapsulation**.
* All the data is stored on the servers, which generally have better security controls than most clients. Servers can better control access and resources, to guarantee that only those clients with the appropriate permissions may access and change data. 
* Since data storage is centralized, updates to that data are much easier to administer than would be possible under a P2P architecture. Under a P2P architecture, data updates may need to be distributed and applied to each "peer" in the network, which is both time-consuming and error-prone, as there can be thousands or even millions of peers.
* Many advanced **client-server** technologies are already available which were designed to ensure security, user friendly interfaces, and ease of use.
* It works with multiple different clients of different specifications.

## Disadvantages
* Networks traffic blocking is one of the problems related to the **client-server** model. As the number of simultaneous client requests to a given server increases, the server can become overloaded. Contrast that to a **P2P** network, where its bandwidth actually increases as more nodes are added, since the **P2P** network's overall bandwidth can be roughly computed as the sum of the bandwidths of every node in that network.
* Comparing **client-server** model to the **Peer to Peer** model, if one server fail, clients’ requests cannot be served but in case of **P2P** networks, servers are usually distributed among many nodes. Even if one or more nodes fail, for example if a node failed to download a file the remaining nodes should still have the data needed to complete the download.
## Examples
Specific types of servers include: web servers, FTP servers, database servers, E-mail servers, file servers, print servers. Most web services are also types of servers.