Web vs Application Server
Both Web Server and Application Server are used to deploy J2EE or other web application, base on Business requirement it’s preferred to chose either of them. In most of case web application is used for small application where only Servlet Container and Connection pool are required like Tomcat,Jetty. But as Application become enterprise and run on distribute operating system and required these modules like Connection pooling, Transaction management, messaging, clustering,session-failover, load balancing and persistence then we move to Application Server like JBoss, Bea,WebLogic, Websphere server, etc.
An Application server is a component-based product that resides in the middle-tier of a server centric architecture. It provides middleware services for security and state maintenance, along with data access and persistence.
Following are key feature of Application and Web Server :-
- Web Server is designed to serve HTTP Content. Application Server can also serve HTTP Content but is not limited to just HTTP. It can be provided other protocol support such as RMI/RPC .
- Web Server is mostly designed to serve static content, though most Web Servers have plugins to support scripting languages like Perl, PHP, ASP, JSP etc. through which these servers can generate dynamic HTTP content.
- Web Server is a sub-set of Application Server means most of Application can also contain Web Server as internal part of them.
- Web Server only supports HTTP protocol but Application Server not only supports HTTP protocal but also other protocol like RMI,TCP/IP and other.
- Web Server is light process and it consume less memory but Application Server is a heavy process and consume more memory than web server.
- Web application does not support EJB (.ear) but supports in Application Server.
- IIS : ASP (.NET)
- Tomcat : Servlet
- Jetty : Servlet
- Apache : Php, CGI
- MTS : COM+
- WAS : EJB
- JBoss : EJB
- WebLogic Application Server : EJB
When We use an Application Server :-
You should consider an application server when you have a need for:
- Integration with existing systems and databases
- Website support
- Load balancing and Session fail-over
Secondary reasons to use application servers derive from the primary reasons. A few secondary reasons are:
- Web-integrated collaboration
- Component re-use