SUN CA : University of Delhi Agraj's Weblog

Friday May 02, 2008

I have been bugged with this question many a times so finally i have decided to write a small blog entry on the same. :-)

An Application Server (like Glassfish) is more sophisticated and complex (read intelligent) when compared with a Web Server (like Tomcat). A Web server is based on HTTP request-response model and generally acts as a web container for JSP's and Servlets. You give it a request and back comes the reply.

On the other hand, an Application Server can be used to serve business logic to applications programs, generally in a n-tier architecture (n>2), through any number of protocols (HTTP, HTTPS, IIOS/SSL). It is this capability of an appserver to cater the needs of a separate business layer in a 3-tier architecture through a component API (like EJB's) that makes enterprise level applications far more scalable. By separating the business logic from presentation layer, we make the business logic reusable between and within applications. Moreover, an application server manages its own resources. It takes care of other important issues like Transaction Management, Security, Database Connection Pooling, Clustering, Scalability and Messaging etc. A web server cannot provide these.

An Application server like Glassfish also provides the administrator with something known as Glassfish Admin Console, using which he/she can easily manage and utilize various resources like Connection Pools, JavaMail Sessions. More on this coming up soon.

Generally, all application servers contain a web server in them or you can say that a web server is a small subset of what comprises of an Application Server. Generally, all application server comes with two types of containers:

  • Web Container
  • EJB(Enterprise JavaBeans) Container

Difference b/w Glassfish & Tomcat in Arun Gupta's words,

- Tomcat is only a JSP/Servlet container. Everything else such as Web services, all the "Web 2.0" style processing, etc need to be installed in the container. Because it's only JSP/Servlet container, it's light-weight.
- Glassfish is a full Java EE 5 compliant App server. JSP/Servlet is just one component of Java EE 5, then there is Enterprise Java Beans, Web services, XML Binding, Security, Reliability, Transactions, Clustering, High Availability, Fault Tolerance and such enterprise features. GlassFish comes pre-bundled and pre-configured to handled those. In case of Tomcat, you need to install additional software for each of these components.

As a matter of fact, i'm an avid follower of Glassfish and strongly recommend Glassfish to developers worldwide, various reasons pamper me to do so:

  • It is Open Source
  • It's supported, maintained & developed by Sun Microsystems and others too.
  • It is fully Java EE 5 compliant and any new technology as and when introduced (even in future), GF will support that also.

Comments:

Put another way, application servers are large and complicated. Web servers are lean and purpose-built.

Posted by 69.104.140.60 on May 03, 2008 at 09:34 AM IST #

But Web servers do not scale to enterprise level applications. Nor do they provide you with stuff like Security, Clustering, Recovery & Backup, Reliability and they are not Fault Tolerant. Also, i'm not aware of any big organization that uses web servers for developing and deploying their applications.

Posted by Agraj on May 03, 2008 at 11:41 PM IST #

"Scale." You keep using that word. I do not think it means what you think it means.

Web servers are scalable precisely because they avoid the stateful, bloated cruft that comes bundled with application servers. Take eBay as an example; though the J2EE buzzword is tossed around, the reality is that their "application server" tier is built entirely on Servlets. That's the technology one finds in web servers like Tomcat, the technology you denigrate, the technology that actually does scale.

Buggy, complicated application servers are a great way for software vendors to sell support contracts. They're not a practical way to scale a real enterprise application.

Posted by 69.104.140.60 on May 06, 2008 at 12:02 PM IST #

hi sir! this is uday doing my MCA in INDIA.

sir could you please send ME the TOTAL seminar information on "WEB SERVER VS APPLICATION SERVER".

I hve searched in many sites but i m un ble to get that so could you please send the seminar please its urgent.

thank u sir!

Posted by uday kumar on February 28, 2009 at 03:23 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed