Learning Oracle Glassfish Server For Tomcat Users: An Oracle White Paper May 2010
Learning Oracle Glassfish Server For Tomcat Users: An Oracle White Paper May 2010
Learning Oracle Glassfish Server For Tomcat Users: An Oracle White Paper May 2010
May 2010
Introduction
There is a direct connection between the Web container technology used by developers and
the performance and agility of applications. This white paper demonstrates the similarities and
differences between Oracle GlassFish Server and Apache Tomcat, allowing Tomcat users to
make an informed decision about which is application server is right for their environment.
For Web 2.0 startups, application service providers, and independent software vendors (ISVs)
offering dynamic Web-based applications, the application is the business—and the Web
container technology used in the application server can affect business results. The Web
container is the part of an application server that manages servlets, JavaServer Pages (JSPs),
and other Web-tier components. Web container technology plays a vital role in determining the
performance and adaptability of Web-tier software components.
Oracle asserts that the Web container features of Oracle GlassFish Server are far more
extensible, modular, easy to use, and adaptable than those of Tomcat, while offering
comparable performance. With support for clustering, persistence, messaging, and other key
features that Tomcat lacks, as well as enterprise-class service and support from Oracle and
the backing of a large and thriving community, Oracle GlassFish Server is a superior
alternative for those who wish to move beyond Web-tier application development.
1
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
2
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
interface (CLI). The callflow monitoring feature in Oracle GlassFish Server 2 enables an application
developer or server administrator to determine where an application is spending most of its time.
This feature will also be available in Oracle GlassFish Server 3. In addition, third-party vendors can
make their software available via the update center feature in Oracle GlassFish Server for easy setup
on Oracle GlassFish Server. With Tomcat, new software must be configured in a piecemeal fashion.
The update center feature also provides early access to newer versions of technologies such as EJB
3.1, which allows for bundling EJB as a Web Application Archive (WAR) file, rather than having to
package the application as an Enterprise Archive (EAR) file.
• Support for scripting languages. Oracle GlassFish Server enables running applications written in
Ruby/JRuby, Python/Jython, Groovy, PHP, JavaScript/Phobos, Scala, and other languages.
Usability/Productivity
Oracle GlassFish Server is more usable and generates more productivity than Tomcat for the following
reasons:
• The update center feature (available in Oracle GlassFish Server 2 and Oracle GlassFish Server 3)
offers developers point-and-click access to additional features that can extend Oracle GlassFish
Server. Examples include Jersey (JAX-RS 1.0) for building RESTful Web services.
• The ability to retain sessions across application redeployments, available in Oracle GlassFish Server
3, is a time-saver for developers creating Java Web applications.
• Alternate docroots at the virtual server and Web applications means that Web applications no longer
need to bundle resources as part of the Web application docroot; they may be shared by other Web
applications. For example, common images such as icons no longer need to be packaged together,
saving time and effort.
3
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
listeners that were associated with it. This is extremely useful for virtual hosting, where one could
run multiple Websites on the same physical server machine. This feature also helps with better
hardware resource utilization, as compared to running each site on a separate machine.
• Oracle GlassFish Server 3 provides superior Comet/Ajax Push to that of Tomcat. With Tomcat, the
developer needs to write a lot of code to get the same Comet functionality provided by Oracle
GlassFish Server.
• Oracle GlassFish Server 2 centrally manages HA cluster and load balancer agent configuration.
Security
Oracle GlassFish Server is more secure than Tomcat for the following reasons:
• With virtual server security realms (available in Oracle GlassFish Server 2 and Oracle GlassFish
Server 3), you can specify security in many realms, including a file realm, a database realm, and a
Lightweight Directory Access Protocol (LDAP) realm. Security realms are specified in the domain’s
configuration and referenced by Web applications with authentication requirements deployed to the
domain. It is also possible to reference security realms at the virtual server level, in which case the
security realm applies to all Web applications deployed to the virtual server (a Web application may
still override the security realm at the virtual server level with its own). This allows a virtual hosting
company to enforce homogeneous security requirements for all the Web applications hosted by it.
• Oracle GlassFish Server supports Java Authentication and Authorization Java Specification Requests
(JSRs) 115 and 196.
• Various 118N enhancements in Oracle GlassFish Server 2 and Oracle GlassFish Server 3 allow for
HTTP request encoding detection (configurable in sun-web.xml).
1grizzly.dev.java.net
4
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
• Oracle GlassFish Server 2 and Oracle GlassFish Server 3 include various performance optimizations,
such as “flattened valve invocation,” a modification to the valve architecture that streamlines how
each valve gets called, resulting in smaller stack depth and better performance. Oracle GlassFish
Server 3 can support Tomcat-style valves as well.
• Oracle GlassFish Server now supports JSR 199, the Java Compiler API, for JSP compilations.
Preliminary performance measurements show an order of magnitude improvement in raw javac
compilation speed, and an overall execution 3.5 times improved when running JSP Technology
Compatibility Kit (TCK) tests.
Extensive scalability testing has been performed in-house to compare the NIO connectors of Tomcat
and Oracle Glassfish Server. These tests use a simple servlet to minimize the time spent in the
container and measure how many operations per second the various containers can support for
increasing numbers of users. For example, at 16,000 users, the in-house benchmark gives the results
shown in Table 1. 2
2 weblogs.java.net/blog/sdo/archive/2007/05/how_to_test_con.html.
5
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
SERVER 2 SERVER 3
Tomcat valves x x x
mod_jk support x x x
Java EE–certified x x
Upgrade tool x
6
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
Verification tools x
Embeddable server x
High availability x
7
Oracle White Paper—Learning Oracle GlassFish Server for Tomcat Users
Conclusion
At all levels, Oracle GlassFish Server is simply a better option than Tomcat for developers and
companies aiming to expand beyond Web-tier applications. Benefits of Oracle GlassFish Server
include the following:
• Oracle GlassFish Server is a collection of Java EE containers, not just a Web container
• Oracle GlassFish Server is much more extensible and modular than Tomcat, and can be easily
expanded as developers take advantage of capabilities such as messaging, clustering, failover, and
session management, and use more features such as EJB, JMS, JPA, and Web services.
• Oracle GlassFish Server supports many powerful Web container capabilities that Tomcat does not,
and supports many of the best-known Tomcat features.
The choice of an application server is highly strategic for businesses, and Oracle GlassFish Server has
proven to be a superior strategic option for developers of next-generation applications.
8
Learning Oracle GlassFish Server Copyright © 2008, 2010, Oracle and/or its affiliates. All rights reserved.
for Tomcat Users This document is provided for information purposes only and the contents hereof are subject to change without notice.
May 2010 This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed
orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose.
Oracle Corporation We specifically disclaim any liability with respect to this document and no contractual obligations are formed either
World Headquarters directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any
500 Oracle Parkway means, electronic or mechanical, for any purpose, without our prior written permission.
Redwood Shores, CA 94065
U.S.A. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
Worldwide Inquiries:
Phone: +1.650.506.7000 AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro
Fax: +1.650.506.7200 Devices. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
oracle.com used under license and are trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered
trademark licensed through X/Open Company, Ltd. 0510