Jan 8, 2010

Application Server vs Web Server

Recently I have faced a question in an interview about difference between application server and web server.
While in interview I have some what explained the difference by intuition but was not very clear about the answer
on theoretical grounds. My answer was

Web Server makes subset of Application Server as it server only web application while application server can serve web and other type of applications

Later I searched web on this topic and found similar explanations.


Q. What is the difference between an application server and a Web server?

A. Taking a big step back, a Web server serves pages for viewing in a Web browser, while an application server provides methods that client applications can call. A little more precisely, you can say that:

The Web server
A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols. A Web server handles the HTTP protocol. Understand that a Web server's delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it. The Web server doesn't provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging.

The application server
As for the application server, according to our definition, an application server exposes business logic to client applications through various protocols, possibly including HTTP. In most cases, the server exposes this business logic through a component API, such as the EJB (Enterprise JavaBean) component model found on J2EE (Java 2 Platform, Enterprise Edition) application servers. Moreover, the application server manages its own resources. Such gate-keeping duties include security, transaction processing, resource pooling, and messaging.


One more interesting thing which has reduced the difference lines between web and application server

Recently, XML Web services have blurred the line between application servers and Web servers. By passing an XML payload to a Web server, the Web server can now process the data and respond much as application servers have in the past.
Hope you have well understood the concept. So keep watching for more interview teasers

Some of the contents of this post are taken from Java World

6 comments:

  1. I'd answer to this question very much like you, emphasizing the fact that app server in java (don't have much to say about .net platform) is nothing more then application running on the JVM.

    ReplyDelete
  2. Sounds good.. Keep posting..

    ReplyDelete
  3. WebServer:-
    Supports HTTP protocol. When the Web server receives
    an HTTP request, it responds with an HTTP response,
    such as sending back an HTML page (static content) or
    delegates the dynamic response generation to some
    other program such as CGI scripts or Servlets or JSPs in
    the application server.

    Uses various scalability and fault-tolerance techniques.




    Application Server:-

    Exposes business logic and dynamic content to the client
    through various protocols such as HTTP, TCP/IP, IIOP, JRMP etc.

    Uses various scalability and fault-tolerance techniques. In addition
    provides resource pooling, component life cycle management,
    transaction management, messaging, security etc.
    Provides services for components like Web container for servlet
    components and EJB container for EJB components.


    Regards,
    Muhammad Abid

    ReplyDelete
  4. is it just me or did you copy pasta this without attribution from http://www.javaworld.com/javaworld/javaqa/2002-08/01-qa-0823-appvswebserver.html ?

    ReplyDelete
    Replies
    1. Hi

      I have already mentioned in the bottom of the post

      Some of the contents of this post are taken from Java World (http://www.javaworld.com/javaqa/2002-08/01-qa-0823-appvswebserver.html)

      Delete
  5. Nice post!

    There's a good explanation here as well:

    http://www.programmerinterview.com/index.php/general-miscellaneous/web-vs-application-server/

    ReplyDelete

Your comments are valuable to us