How Does a Server Work?

Page content

What is a Server?

There are various kinds of servers that one encounters (or hears about) these days, including: web servers, email servers, file servers, name servers (domain name servers), application servers, database servers, etc. The simplest definition of a server would be a computer that provides a specific service to users. Usually these users have to access the service by first accessing a client. The client software is installed on the user’s machine and the user interacts with this client software. In response to specific requests made by the user, the client software sends requests for a service to the server. The server then handles this request and returns a result to the client, which then displays this to the user. The response differs, depending on the service requests that are being handled. A print server may simply respond by signaling the completion of a print request. The following are some examples of the type of servers in use today.

Web Server: The web browser acts as the client and the machine that serves a specific webpage in response is the web server. When you type a URL, the web browser sends an HTTP Request to the web server and the web server will return the requested webpage as a result, which is then displayed on your web browser. Note that in this case, the HTTP Request passes over the Internet to a remotely located server.

Email Server: In this case, your client is a software such as Outlook, which accesses email from an email server. Depending on what you are doing – sending, deleting, etc. – a request will be sent and handled appropriately by the email server. In the simplest, office-type scenario, the email server is located in the same office as you. The request/response travels only over the LAN/Intranet.

However, it is also possible that the email server is accessed over the internet from a remote location. It is becoming common to access office email through the Web (generally referred to as Webmail). This could be because of various reasons, such as telecommuting, mail services being handled by a third party, etc.The email server is accessed, in such cases, by passing through a web server first. Thus the client is once again the web browser, which communicates with a web server. The web server in its turn, acts as a client and sends a request to the email server. The response is then handled by the web server by sending the response to the web browser, which eventually displays it on screen.

Even in peer-to-peer applications, such as when downloading a file from a remote peer, your computer is implicitly acting as a client to the remote peer’s server. This situation can just as easily be reversed when that same user downloads files from your computer.

Requirements of a Server

So what do these server types need to fulfill their roles? Back in the day (say the 90s), a server was a much more powerful computer than your run-of-the-mill desktop computer. The distinctions have tended to get blurred as desktops keep packing more and more power in them. To begin with, a server needs to have the capability to handle all the incoming requests (we shall look at how these requests are handled soon). This means that there has to be a sufficient amount of incoming communication bandwidth to support all the incoming requests. There can be literally hundreds or thousands of parallel requests coming in. In many cases, this may mean having an NIC (Network Interface Card) with more than one port (at least one dedicated for receiving requests, another for sending back responses, and so on).

Similarly, because of these large number of parallel requests, the server needs to have sufficient computational resources. A decent amount of system memory or RAM is essential and depending on the type of server, a fair amount of secondary storage will be necessary. In most cases, a server has to store something (email, files, records) and so it needs to have enough storage to be able to handle this. Obviously the right software has to be there to enable the given computer to function as a server.

Continue on to the next page to find out more about how a server works.

Other Requirements of Servers

Additionally reliability, availability and serviceability are important considerations for a server. Theoretically, a server should be ready and available, functioning reliably and error-free most of the time. In practice, this is not going to happen, but down-times should be kept to a minimum. This often means that there has to be a fair amount of exception and error handling capacity in the software, and also that the system has to be secured against a wide variety of threats and malicious attacks. Serviceability is the measure of how quickly and easily the server can be repaired in case something does go wrong. Downtime will be required for software updates, etc. which necessarily will have to be done periodically.

How Does a Server Work?

Since a lot of clients depend on a server for services, it is desirable that a server needs to be available, if possible, all the time. During this time, some part of the server software should be listening for requests coming in. This is referred to as a daemon (a daemon is used to describe any program that runs in the background in an OS).

Once a request arrives, the daemon handles this by staring a new server process or thread to handle the specific request, and immediately goes back to “listening.” In the case of a web server, this first incoming request is always a request for connection, which is handled by setting up a new connection with the server process/thread handling it. Next the actual request (for the specific page) comes to this process/thread and is handled accordingly. The connection is usually dropped at the end of a request/response cycle, although numerous variations exist such as keeping the connection alive for longer until a stream of requests is handled and so on. In many cases, where there are a large number of expected requests, these server processes and threads may already be running and allocated/de-allocated on-the-fly for the sake of efficiency, instead of wasting time creating and destroying them.

Types of Servers

Here is a listing of a few common server types:

  1. Web Server: A server that maintains webpages.
  2. Email Server: A server that stores, sends and receives email.
  3. Database Server: A server that maintains a Database and provides access to it.
  4. Print Server: A server controlling a network printer.
  5. File Server: A server that stores files. Files can be uploaded to or downloaded from this server.
  6. Application Server: A server that has a number of applications on it, and grants access to users who want to use these applications.