Ever wondered what role a server plays when building a website? and what is the difference between web servers and application servers?

In this article, we will study web servers and application servers. It will clear some of your doubts regarding web servers and application servers. As well as give more knowledge about web servers and application servers for beginners.

Web Servers And Application Servers

let's begin with what a web server is. 

What is a web server?

what is a web server

A web server is a computer system that hosts websites. So what do you mean by websites? Simply it's a collection of web pages. So for example, when you open Amazon it's a website. It does not have a single web page but it has multiple web pages. 

When you open the link, you will see the home web page. But, when you click on a product. The product web page comes up. There you will see multiple things, the image of the product, product information, and even recommendations. 

So that’s a website and then any computer system can be a web server 

what is the difference between a normal computer system and a web server 

Difference between a normal computer system and a web server

The difference is that this computer system is running a web server software. For example, Apache HTTP web server. This is the most popular one today as of now. Then we have Microsoft IIS and some others. 

So is this the only difference that a computer system and a computer system running web server software have? no, there is one more difference. The computer system needs to be connected to the internet in order to act as a web server. Otherwise, web clients cannot contact it through HTTP. 

Connect it to the internet and it should be running a web server software. 

Typically, web servers host multiple websites. Some only host a few while others may host several hundred but there are some dedicated servers also. 

Based on that we will categorize a web server into two parts. The web servers host websites for multiple users. We call them shared hosts. There are some dedicated web servers that will be hosting websites for a single person or company. We call them dedicated hosts. 

Which servers are shared and which are dedicated?

Let's say there is some personal website or some small website that does not have a huge amount of traffic. Then will host it on shared hosts. But if there is a huge website and it has high traffic, then that requires a dedicated server. Also, if the sites require custom server modification then it will go for dedicated hosts. 

Now let's understand how this webserver works

How a web server works

If we have a web server then there must be a client whom the server is serving. Let’s call it a web client. This client sends an HTTP request to the webserver. It will request for some page or it will require some other resources. Typically, there are two possibilities that can happen when a request is sent. One, the requested URL or the page or the file that is requested is available with the webserver. Then it will immediately send an HTTP response with the file.

Another possibility may be, that the requested page or file is not present on the webserver. So it can look into a static database. A static database is a database the webserver can contact and fetch the file. There may be a scenario where the page is not also present but it needs some processing.

What this web server will do is, send a servlet request to the application server. A servlet is a server that serves business logic to application programs through any number of protocols. Web server exclusively handles HTTP requests. You can now see the application server coming into the picture.

Quick Information:

What is a servlet? If you may be wondering, a servlet is a small java program that runs with a web server. Servlets receive and respond to requests from web clients usually across HTTP. These will be some java programs and will require some processing. It will send this servlet request to this application server to contact the application data store. SO that it can process or run this servlet. Then fetch some details from here and do further processing.

Then it will send a servlet response to the webserver and now this webserver has the response built-in. The web server will send an HTTP response back to the web client and this is how a web server works. 

Take note that you will only require the application server when there's intense processing that a web server cannot handle. 

Now let's see some of the examples of web servers.

Examples of web servers

1. Apache HTTP server

One most popular web servers are the Apache HTTP servers. A rough estimate, 60 percent of the web servers run Apache web servers. You can install it on all operating systems including Linux, Unix, Windows, FreeBSD, Mac os, osx, and more. It's open-source software so all of these are related to its popularity that's why it's so popular. 

2. Internet Information Services

Then we have internet information services or in short IIS. Microsoft IIS developed it. It runs on Windows NT 2000 and 2003 platforms. Tightly integrated with the operating system. It is also easy to administer. 

Then we have some other web servers like LiteSpeed, Lighttpd, sun java system web server, and jigsaw server. There are a few more but those are not that popular. I hope we now have a good understanding of web servers. We also know the most popular web servers and how web server functions. 

Let's quickly look at the application server 

Application servers

The application server is a server that is specifically designed to run applications. As we had seen, this was coming into the picture when this web server did not have the request ready. It needed to run some java program to build the response. Because it's designed for running applications, it includes both hardware and software that provide an environment for programs to run. 

Uses of application servers

  • Used for running web applications hosting a hypervisor that manages virtual machines. Hypervisors are software programs that manage one or more virtual machines.
  • Used to create a start, stop and reset virtual machines
  •  Used for distributing and monitoring software updates 
  • Also, processing data sent from another server. 

Now we have some idea why we use an application server.

To Sum Up: Web Servers And Application Servers

A webserver is designed and often optimized to serve web pages and not more than that. Therefore, it may not have the resources to run demanding web applications. That’s where the application server provides the processing power and the memory to run these applications in real-time.

It also provides the environment to run specific applications. For example, let's say a cloud service may need to process data on a windows machine. A Linux-based server may provide the web interface for the cloud service but it cannot run the Windows application. It can just provide an interface. Therefore, it may send the input data to a windows based application server.

If a web server is running on Linux but it cannot process some application that can only run on windows. It has to contact the application server which will be running on windows and then it will run that application. It may send input data to a windows based server. Then the application server can process the data and then return the result to the webserver. 

so this is some intuition why we need an application server. I hope I was able to clear some of your doubts regarding the webserver and application servers. 

Read more articles about websites here at BuildSite.

Thank you.