Open In App

How do Web Servers work?

Last Updated : 15 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Internet acts as a source of a plethora of information to us and all we need to do if we want any information is to just query the internet and then we will get the desired response. 
But who provides this information to us and how? All this is facilitated by what is called the Web Server. Along with it, there are browsers as applications we use such as Internet Explorer, Mozilla Firefox, Chrome, Safari, etc to interact with the web and browse & retrieve the files on web servers known as Web Clients. 

Web Servers are basically simple computer programs that dispense the web page when they are requested using the web client. The machines on which this program runs are usually called a server, with both the names web server and server almost used interchangeably. 

Generally, many people, when they think of web servers, think of them being some high-powered computers, while this is correct to some extent, some high-powered computers are also called web servers, but these computers are built with the purpose of web hosting. In web hosting, the web servers enable the hosting providers to handle multiple domains (or multiple websites) on a single server. But, normally, when someone refers to a web server, it means the piece of software that can be downloaded on the computer system. 

When is a web server required?

Generally, web servers are used by web hosting companies and professional web app developers. But, actually, anyone who satisfies one of the below categories can use it- 

  • One who owns a website (to make the local copy on their system resemble what is on the internet).
  • One who wants to use server-side technologies, such as PHP or ColdFusion, can also use the web server.

How do Web servers work?

A page on the internet can be viewed, when the browser requests it from the web server and the web server responds with that page. A simple diagrammatic representation of this is given below in the figure: 

The simple process consists of 4 steps, they are: 

  • Obtaining the IP Address from the domain name: Our web browser first obtains the IP address the domain name (for e.g., for this page the domain name is www.geeksforgeeks.org) resolves to. It can obtain the IP address in 2 ways- 
    • By searching in its cache.
    • By requesting one or more DNS (Domain Name System) Servers.
  • Browser requests the full URL: After knowing the IP Address, the browser now demands a full URL from the web server.
  • The web server responds to request: The web server responds to the browser by sending the desired pages, and in case, the pages do not exist or some other error occurs, it will send the appropriate error message. 
    For example: 
    You may have seen Error 404, while trying to open a webpage, which is the message sent by the server when the page does not exist. 
    Another common one is Error 401 when access is denied to us due to incorrect credentials, like username or password, provided by us.
  • The browser displays the web page: The Browser finally gets the webpages and displays it, or displays the error message.

Performance Measure of web servers: There are various parameters that define the performance of a web server that are measured under various loads and requests and responses from clients and servers. 

  • RPS: RPS stands for Requests per second. It determines the maximum number of requests a server can handle from various clients. It depends on various other things such as HTTP version, type of HTTP requests, etc.
  • Latency: Network latency is the response time that a server takes to process each client’s request. This is calculated in milliseconds.
  • Throughput: It is defined as the amount of data transferred in a given amount of time. It is calculated in bytes per second. Where latency should be very low for an ideal server, throughput should be very high. 
  • Concurrency: Since RPS, latency, and throughput can fluctuate highly depending on the number of active clients and connections, concurrency is another parameter that is used to check the performance of a web server. This is supported by web servers under various specifications such as server configuration, type of operating system, and hardware resources.

Popular Web Servers: There are quite a few web servers available, like, Apache, Microsoft IIS, Nginx Web Server, and LightSpeed Web Server. But, the two most popular ones are- 

  • Apache HTTP Server: It is the most popular web server available and is widely used. It is developed and maintained by Apache Software Foundation. The Software is produced under the Apache License, which makes it free and open source. 
    It is available for a variety of operating Systems- Windows, Mac OS X, Unix, Linux, Solaris, Novell Netware and FreeBSD. 
     
  • Microsoft Internet Information Service: Microsoft IIS (Internet Information Service) is the second most popularly used web server, and its market share is increasing quite rapidly with each passing day and is likely to overhaul Apache in the upcoming years. 
    IIS server has all the features just like Apache, but it is not open source. It is developed and maintained by Microsoft, thus it works with all the Windows operating system platforms.

Summarizing it all, web servers can be used by an individual or by web hosting provider companies. In case an individual does so, he will be locally hosting the website only on his own system (i.e., the contents of the website can be accessed only on the local system and not on any other system), whereas when hosting provider companies hosts them, the website can be viewed by anyone across the globe. An individual can also host his website publicly with his web server, but for that, one must have a leased line internet connection (to get a dedicated IP address) and a DNS server to connect it with the domain of the website (generally not preferred due to security reasons). 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads