Monday, December 21, 2009

GlassFish vs Tomcat

At first, I must tell you that Glassfish and Tomcat is not to be compared as one is a App server and other is a simple web server. But since most of the people seem to ask the question, I have put down a few words here which may be helpful.

Tomcat is a decent enough web server for the smaller scale applications.
Glassfish, JBoss, Websphere, etc. are heavy weight application servers that support the EJB standard and many more advanced features out of the box.
If you want to use Enterprise Javabeans in your application then Glassfish or similar application servers are the way to go; if you only want to develop using servlets & JSPs or possibly a POJO based framework like Spring, Tomcat may be more than enough.

Then again, if you are writing a critical business application for which for example security is a big deal, you may want to start thinking about an application server again.
It all depends on the requirements.

Tomcat is part of Glassfish :
Glassfish uses a derivative of Apache Tomcat as the servlet container for serving Web content.

Below are the advantages of App server like GlassFish over Web server like Tomcat
  • Data and code integrity
    By centralizing business logic on an individual server or on a small number of server machines, updates and upgrades to the application for all users can be guaranteed. There is no risk of old versions of the application accessing or manipulating data in an older, incompatible manner.

  • Centralized configuration
    Changes to the application configuration, such as a move of database server, or system settings, can take place centrally.

  • Security
    A central point through which service-providers can manage access to data and portions of the application itself counts as a security benefit, devolving responsibility for authentication away from the potentially insecure client layer without exposing the database layer.

  • Performance
    By limiting the network traffic to performance-tier traffic the client-server model improves the performance of large applications in heavy usage environments.

  • Total Cost of Ownership (TCO)
    In combination, the benefits above may result in cost savings to an organization developing enterprise applications. In practice, however, the technical challenges of writing software that conforms to that paradigm, combined with the need for software distribution to distribute client code, somewhat negate these benefits.

  • Transaction Support
    A transaction represents a unit of activity in which many updates to resources (on the same or distributed data sources) can be made atomic (as an indivisible unit of work). End-users can benefit from a system-wide standard behaviour, from reduced time to develop, and from reduced costs. As the server does a lot of the tedious code-generation, developers can focus on business logic.


Conclusion
Given the above benifits, we need to find out whether we are actually using these features. If not, then the app server is nothing but a burden. If you think you may use these features in the future, then we better use the app server in the future itself. Since the point which needs to be noted is that Glassfish actually uses Tomcat for serving web content.

If you think we need few of the goodies which come with app server like security, performance, transaction support, centralised configuration. We need to find out if we are actually using those and if yes, then we have to stay with Glassfish. If not, how can we implement them and take advantage of using a application server like GlassFish.

No comments:

Post a Comment