What’s the difference between an application server and a web server?

 

As the name implies, an application server hosts instances of a specific application, but provides a great deal of other functionality as well. The application server provides most, if not all, of the business logic that may be needed in order to process requests from the client application. The client application can use this business logic as if it were calling an object’s method – this also means that any data needed by the client application is also generally retrieved by the application server from some data source. Thus, an application server could be said to centralize the services typically needed by client applications. In addition, an application server can be said to simplify the actual development of the client application(s). This is because application servers provide building blocks (sometimes called components) that, when assembled, help create the application itself. An example of a component would be enterprise java beans, which are the main component used by J2EE application servers.

The term application server applies to all platforms. However, the general term "application server" is often used to refer specifically to application servers that conform to the Java Platform Enterprise Edition (J2EE) standard. You should clarify with your interviewer what he means if he uses the term. Also, the term application servers doesn’t always refer to servers that host applications only used for the Web, as some application servers target networks other than the Web. For instance, SIP servers are used for telephony networks, but they are still considered application servers.

Subscribe to our newsletter on the left to receive more free interview questions!

A Web server hosts web pages that can be seen in a Web browser. A Web server exclusively handles HTTP requests, and always responds using HTTP as well. This is in contrast to an application server, which can use protocols other than HTTP. In order to process a request for a web page, a Web server can do a number of things depending on the nature of the request: reply with a static HTML page, delegate the dynamic response generation to another appropriate program, such as server side scripts (like CGI), servlets, etc. The server-side technology varies, but the goal of such technologies is to generate a response, usually in HTML, to be viewed in a Web browser. When the Web server receives a request, it will pass the request to the server side program that it thinks is most suited to handle the request. This delegation of work is a fairly straightforward process, and the Web server doesn’t add anything else to the process other than providing an environment in which the server-side program can execute and pass back the generated responses.

Both Web and application servers may employ various strategies for fault tolerance and scalability such as load balancing, caching, and clustering – so the functionality of a web server is not just limited to handling HTTP requests, and delegating the work. Clearly, Web servers don’t provide the business logic to handle certain requests like application servers. Also, Web servers don’t provide any building blocks that help in the creation of their Web pages, whereas application servers provide components that facilitate the application development process.

Most application servers also contain a Web server. But developers rarely use application servers in this manner. When necessary, developers prefer to use Web servers to work alongside (rather than as a subset of) application servers. Separating functionality in this manner allows for better performance (Web requests won’t interfere with the application server performance), better configuration (dedicated Web Servers), and allows developers to select the best product available for the task at hand (developers are not limited to using the Web server that comes as a part of the application server).

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.

Leave a Reply

Your email address will not be published.