Web Server
      A Web server is either a computer program that is based on client-server model or a computer running a ‘program’ that is responsible for accepting and responding to the World Wide Web’s Hypertext Transfer Protocol requests form Web pages . Every computer on the web that with a Web site must have a Web server program to run it.

e.g
  • Microsoft’s Internet Information Server.
  • Netscape servers.
  • Apache
  •      Web server working on delegation model , is quite simple. When client requests for a particular resource (Often HTML pages ), the request arrives into the Web server. Then Web server passes the request to the server side programs that is dedicated to handle that particular request. The Web server doesn’t provide any other functionality rather than providing a stable environment in which the server-side programs can execute and respond back the generated responses. The server-side program itself provides the additional server side functionalities like transaction processing, database connectivity, and messaging.
         Web servers are available as larger package of Internet and related programs like e-mail, handling HTTP requests, creating and publishing web pages etc. Choosing a Web server will depend on many factors like platform , its ability to handle server-side programming, handling search engine , and web page building tools with it etc.
    Application Server
         Application servers are basically servers which provide processing of dynamic content requests by different applications. They are considered as software that helps user to develop and deploy distributed applications . An application server often exposes the application business logic (like EJB) to clients through different protocols, including HTTP. The information traveling back and forth between an application server and its client is not simple display , instead, the information contains program logic ,which user can interpret accordingly. Application server provides additional features like security, transaction processing, resource pooling, and messaging.
    Web Server v/s Application Server
         The difference between application server and web server is the separation of business logic from the presentation logic and the database logic. Application servers help us build true 3-tier applications where the database logic need to be separated from the business logic. Let us consider a small example to clarify these difference.
         Consider a shop with certain products to sell, there will be form for the user to submit their query about the availability and pricing of product . This scenario will be issued in two ways, according to the server.
  • Web server approach
  •      The Web server takes client request, passes it to a server-side program which is responsible for handling the queries. The server-side program query the pricing information from a database or from any other files. Then use the result to formulate the HTML response, then sends it back to client. Here the transaction handling, database connectivity, load balancing all are handled by server side script itself.
  • Web server with an application server
  •      The application server will handle the look up process once the query is submitted , still the server side programs determine what to do with the query but can simply call the server look up service to get the result(eg. look up service in EJB). Then server script forms the response using these results and sends it back to client. The application server will handle the load balancing, transaction management and support various protocols like HTTP, TCP etc by itself.
          Normally the application server has a built-in web server and it makes them to be configured to act as both web server and application server.