What is the difference between web server and application server?

Asked

Viewed 16,110 times

18

What’s the difference between web server and application server? Where each one is/should be used? There is some interaction between them (a software can use the 2 technologies together)?

3 answers

19


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 you requests. Put to run a process that opens a port to meet TCP or UDP connections, and voilà!, you have an application server.

In our Web world we need various 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 called "Web Server". Example: "Apache HTTP Server" or simply Apache.

But that alone is not enough. It is common to need it to serve dynamic data such as custom HTML pages, strings of bytes, files and even images built based 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, specializing in storing data).

One way to solve this is to implement a web server that has dynamic behavior. It’s not very practical: depending on the size of the services that he proposes to provide, we will have to dedicate ourselves to implementing a lot of so-called "infrastructure" logic to build it, such as separating requests into threads to save resources and improve performance, security logic (authentication, authorization) preferably declarative (i.e., based for example on a text-file that someone can modify without having to recompile the whole code of the server), request filtering behavior (for example, the behavior of always authenticating requests intended to serve logged in users before executing their logic), logging, the very logic of interpreting a dynamic page and generating HTML (all this I am blatantly picking up from the book Head First Servlets & JSP which explains why it is better to do it differently using a Container).

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

Another way is by 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 also a server, 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. Container forwards requests to Servlets, which are basically Java classes, and each Servlet executes the request in a thread. You can program a Servlet to fulfill login requests, another to include items in an order, another to delete orders, and so on.

This is also often called "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 an extra server, Container, which is responsible for generating dynamic content. So we can say that in this second definition of application server, the said application server contains a web server.

(Note that in this combined architecture it does not need 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 on a container (which is usually called "web application") is a file . WAR (abbreviation of "Web Archive") which is basically composed by the Servlets that the container will perform some more static content (images, configuration files, etc).

  • Piovezan, you said the following: "Put to run a process that opens a door to meet TCP or UDP connections, and voilà! , you have an application server. " It is the responsibility of the operating system to handle the protocols in the transport layer (TCP and UDP), so it would not be correct to say that the web server is responsible for meeting HTTP requests instead of TCP and UDP. It is not the job of S.O analyze the protocols in the transport layer and after that delegate the control of the data to the web server that will analyze the content of the request?.

  • @Felipecanatto What you said is correct. When I speak meet TCP or UDP connections I should talk connections with stream sockets or Datagram sockets. The type of socket the server opens will determine the transport layer protocol it uses underneath (that is, the assurances as to the receipt and order of arrival of the packets). They’ll be in charge of the O.R. Just like you said. The web server, which usually opens stream sockets, treats incoming bytes as requests from the HTTP application layer protocol.

4

A web server is a application server to meet needs web. 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" system processes that allow clients to make requests and receive responses.

It is obvious that the web server needs to work with HTTP protocols and derivatives. It has some predefined functions that only make sense, or at least make a lot of sense for the normal flow of web solutions. In general several of the tasks a web server needs are the same as for any other type of server application, 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 delegating the specific processing to a application server without expertise (or not) delegating the handling and storage of data to a database server.

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

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

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

That’s basically it. I know some Stacks of technologies prefer to use their own definitions, but I find them restrictive. To learn the way presented by a technology is to follow the imposed cake recipe and some people cling to it. 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 defined functions.

I don’t like, for example, the definitions given in the OS. They relate to specific technologies, consider the term as the market uses and not as 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 one, but it will be very rudimentary and dangerous for external use). There are defined requirements that are nothing simple. But I also don’t say it’s so difficult to write a.

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

And so on. One is specialization of the other.

  • 2

    To have -1 here, or there is someone who is dirty, or someone who does not really understand the subject (or both). If this is bullshit, we can’t argue. If it wasn’t a prank, I would suggest the person actually get out of the box and see that the world is much bigger than what she "thinks" is an application server.

  • Sopt’s like this, people learn the cake recipe and they think that whoever doesn’t follow her is wrong. There’s not much to do, people like to limit themselves.

  • in which case I swear I would prefer it to be dirty (although it hurts the community, and not you, so it’s bad anyway), because if the person really voted against it because they don’t agree with the content, it is a sign that things really go wrong. Tantrum seems less damaging to me than a religious vow.

  • I think you’re right, looking at some things, it seems to have been really naughty.

0

An answer in a few words would be:

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.