The people who work in the development of Java Web Application may have usually come across the terms Web Server, Web Container and Application Server. On the surface all three terms sounds and seems similar. But there is a difference between all three terms.
Lets start with the term Server. Whenever we view an architecture diagram for an application consisting of client-server in a book or in any document, there the server is illustrated as a box, which accepts the requests from the client, processes it and sends the response back to the client. So what goes into that box regarded as server. Is it a just piece of separate hardware or a hardware and software or just a software? Well to be precise in software development environments the server is actually a software.
This software can run on the OS and hardware where the client itself is located (which usually happen while developing the application on local system with server installed on the same machine) or it can even reside on a separate high end processing capability hardware consisting of multiple CPUs with even 100 gigs of RAM and installed on a OS designed for hosting requirements (as in case of actual websites deployed on these servers for hosting the client over network). Without this piece of software the entire hardware is just like a Box and this is what the the hardware in Server Unit left after excluding the server application is called.
So in describing the difference between the terms Web Server, Web Container and Application Server our focus will be on software only.
Web Server is a software/application responsible for receiving HTTP/HTTPS requests from the clients over a network. Web Servers were originally developed to handle requests for the resources such as HTML pages,Javascript,CSS and images. The entire responsibility of a web server is to listen to the HTTP requests and then fetch the resource in the URL requested by the client and return that resource to client. In other words, a web server can serve requests for the static resources on its own and is capable to server the website with static resources and pages only. The deployment of these static application is as easy as just placing the directory with static resource in the root folder of the server's context directory. Apache and Sun One (iPlanet) are the example of such web servers.
This software can run on the OS and hardware where the client itself is located (which usually happen while developing the application on local system with server installed on the same machine) or it can even reside on a separate high end processing capability hardware consisting of multiple CPUs with even 100 gigs of RAM and installed on a OS designed for hosting requirements (as in case of actual websites deployed on these servers for hosting the client over network). Without this piece of software the entire hardware is just like a Box and this is what the the hardware in Server Unit left after excluding the server application is called.
So in describing the difference between the terms Web Server, Web Container and Application Server our focus will be on software only.
Web Server is a software/application responsible for receiving HTTP/HTTPS requests from the clients over a network. Web Servers were originally developed to handle requests for the resources such as HTML pages,Javascript,CSS and images. The entire responsibility of a web server is to listen to the HTTP requests and then fetch the resource in the URL requested by the client and return that resource to client. In other words, a web server can serve requests for the static resources on its own and is capable to server the website with static resources and pages only. The deployment of these static application is as easy as just placing the directory with static resource in the root folder of the server's context directory. Apache and Sun One (iPlanet) are the example of such web servers.
But as the time and internet had evolved and there was a need of web applications dynamic pages and business logic also got involved in web applications, there was also need of development of software or components that can handle requests for dynamic pages by processing the code written in server side scripting languages like ASP, PHP or JSP and servlets. To process the pages written in ASP or PHP (server side scripts embedded in web pages) some plugins were developed which could be integrated with existing web servers and make them capable to handle the requests for the dynamic pages and pass it further to these plugins for generation of dynamic pages, and then return the generated pages.
For the JSP and Servlet (which are Java way of creating dynamic web pages) some new components were developed which are called Web Containers or Servlet Containers These containers provide the api for implementation of HTTPServlet classes and handle the requests for JSP and servlet. These container manages the life-cycle of JSP and Servlets and generate the dynamic pages. The Tomcat, Jetty and Wildfly are example of such containers. Usually these container are delivered as a integrated package of Web Server and Web Container such as Apache Tomcat.
Even if the Web Container were efficient enough to host and handle the request for application with dynamic web pages generated by processing some business logic but those were not much scale-able as per the requirement of Enterprise applications. The Java further came up with the concept of Enterprise JavaBeans which provided a much scale-able and distributed MVC(Model View Controller) approach to develop the business component having the main business logic of application modules. The servers and containers were further evolved to hosts these business components in a separate component called EJB Container or simply Bean Container and this evolved form is called the Application Servers. Weblogic and JBoss are example of such Application server. In these days the Application servers have even evolved further to handle other Java EE Features like Web Services, JMS and persistence.
So Application Server can be considered a super-set which consists of a Web Container and a Web Container further can be considered as super-set which contains the Web Server. This can be depicted as the following diagram:
Image Source: Head First Jsp and Servlets |
Nowadays, most of the application servers comes as a single unit with virtually integrated web container and EJB container as depicted in the diagram. It is very rare that a standalone EJB container can be find. But Web Containers like Apache Tomcat and Web server like Apache and iPlanet are still available and still in use.
The Web Container like Apache Tomcat are quite efficient to host small to medium non EJB Web application applications developed in JSP and Servlet or purely other Java Web Frameworks only.
The Web Servers like Apache and iPlanet are still in use to act as a proxy web server to web applications to enforce DNS and HTTPS configurations and some other HTTP request rules like disabling the cache, filtering the HTML request and response data for avoiding cross scripting and cross frame attacks etc so that all these settings can be decoupled from actual application code and application server with multiple clusters or managed servers.
0 comments:
Post a Comment