What is the difference between web server and application server?

What is the difference between web server and Application Server ? Where each is / should be used? Is there any interaction between them (a software can use the 2 technologies together)?

Author: Maniero, 2016-04-10

3 answers

An application server is simply a server, in the sense of the client-server architecture: a process that serves one or more client applications that send it requests. Put to run a process that opens a port to meet TCP or UDP connections, and voila!, you have an application server.

In our Web world we need several types of servers. One that understands requests made in the HTTP protocol, for example, to communicate with clients spread over the Internet. Minimally this server may be able to serve static data such as static HTML pages, files, and images. It is the so-called "Web Server". Example :the "Apache HTTP Server" or simply Apache.

But that alone is not enough. It is common for us to need it to serve dynamic data, such as custom HTML pages, byte strings, files and even images built on variable information such as the parameters of the request itself or the result of a query to a database (this by itself an application server also, as @Maniero said, specialized in storing data).

One way to solve this is to implement a Web server that has dynamic behavior. It is not very practical: depending on the size of the services that he proposes to provide we will have to dedicate ourselves to implement a lot of logic say "infrastructure" to build it, such as separating requests in threads to save features and improve performance, security logic (authentication, authorization) preferentially declarative (that is, based for example on a text file that someone can modify without having to recompile the entire server code), request filtering behavior (for example, the behavior of always authenticating requests intended to serve logged users before executing its logic), logging, the very logic of interpreting a dynamic page and generating the HTML (this all I am brazenly picking up from the book Head First Servlets & jsp which explains for what reasons it is better to do differently, using a Container).

Another way to do this is to delegate the dynamic part to scripts written in Perl, PHP or some other language. You can also face some of the limitations mentioned, including opening a separate process for each request, which is more expensive than using threads .

Another way is using a Container (also called Web Container or Servlet Container), which is the solution proposed by Java technologies and which I know best. It is a server too, which receives requests from an HTTP server (aka Web server, remember?) and takes care of all the infrastructure logic mentioned above, leaving you free to implement only the business logic that interests your specific application. O Container it passes the requests to Servlets, which are basically Java classes, and each Servlet executes the request on a thread. You can program one Servlet to fulfill login requests, another to include items in an order, another to delete orders, and so on.

This is also often called an "application server", in the sense that I believe you had in mind when you asked your question. It consists of a Web server, and also a server extra, The Container, which is responsible for generating dynamic content. So we can say that in this second application server definition, said application server contains a Web server.

(Note that in this combined architecture it does not have to be a Web server, nor that the protocol is HTTP; but it is the most common in the Web world).

Application server example: Apache Tomcat (Apache web server + container of servlets ). Note: Tomcat also has an alternative HTTP server called "Apache Tomcat HTTP Server".

In Java, an application intended to run in a container (which is often called a "web application") is a file .WAR (short for "Web ARchive") which is basically composed of the Servlets that the container will run some more static content (images, configuration files, etc.).

 18
Author: Piovezan, 2019-09-13 19:47:12

A web server is a Application server to serve web needs. For example, contrary to what many people think, Microsoft'S IIS is a Application server, and one of its functions is to serve web.

An application server "hosts" processes in a system that allow clients to make requests and receive responses.

It becomes obvious that the web server needs to work with HTTP and derivative protocols. He has some predefined functions that only make, or at least make a lot of sense for the normal flow of web solutions. In general, several of the tasks that a web server needs are the same as any other type of application server, including database access activities and / or delegation of part of the task to a mechanism outside the server itself (called an executable or script).

You can have a web server that delegates specific processing to a application server without specialization (or not) that delegates data manipulation and storage to a database server.

So some people can use the term application server only for the host of the business logic (runs the application environment in general). Some will then consider that every web server is a application server in this sense, since it runs business logic through scripts .

Others consider that only static content is what the web server treats and any dynamic content is part of the application server.

People forget that HTTP is just a normal application with specific rules.

Is basically this. I know that some stacks of technologies prefer to use own definitions, but I find them restrictive. Learning from the form presented by a technology is to follow the cake recipe imposed and some people cling to this. In some cases I see the term Application server being used for a set of available services. That's right, that's a app server with some functions defined.

I don't like, for example, the definitions given in the OS. They attach themselves to specific technologies, they consider the term as the market uses and not as it suggests computing as a whole.

You can write an application server with few lines of code. It depends on the requirements. A web server, for example is no longer so simple (you can even make a simple, but it will be very rudimentary and dangerous for external use). There are defined requirements that are not at all simple. But I also do not say that it is so difficult to write one.

As a complement we can say that a database serveris a specific Application server to give access to stored data.

And so on. One is specialization of others.

 4
Author: Maniero, 2019-12-23 16:11:52

An answer in a nutshell would be:

  • An Application Server serves processes that allow clients to make requests and receive responses;
  • a Web server is a specialized application server to meet Web needs. That is, it needs to work with HTTP and derivative protocols.

Therefore, the Web server works through the HTTP protocol, while the Application Server is not restricted to it, and can support other protocols, such as RMI / RPC.

 0
Author: Diego Aguiar, 2019-06-24 23:55:50