Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

GlassFish 2 vs. Tomcat 6

In Switched, Dave says:

Now that Glassfish V2 is out I'm switching from Tomcat to Glassfish for all of my development. It's more than fast enough. With Glassfish on my MacBook Pro, Roller restart time is about 8 seconds compared to 16 with Tomcat. And the quality is high; the admin console, the asadmin command-line utility and the docs are all excellent. The dog food is surprisingly tasty ;-)

I did some brief and very non-scientific performance comparisons myself:

Startup Time with no applications deployed:

  • Tomcat 6: 3 seconds
  • GlassFish 2: 8 seconds

Startup Time with AppFuse 2.0 (Struts + Hibernate version) as a WAR

  • Tomcat 6: 15 seconds
  • GlassFish 2: 16 seconds

Environment:

  • JAVA_OPTS="-Xms768M -Xmx768M -XX:PermSize=512m -XX:MaxPermSize=512m -Djava.awt.headless=true -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC -server"
  • OS X 10.4.10, 2.2 GHz Intel Core 2 Duo, 4 GB 667 MHz DDR2 SDRAM

Since this was a very non-scientific experiment, it's possible the last two are actually the same. It's strange that Dave is seeing Roller startup twice as fast on GlassFish. Maybe they've done some Roller deployment optimization?

I realize startup times aren't that important. However, as Dave mentions, they (and context reloading) can be extremely important when developing.

Update: I got to thinking that Dave is probably referring to context reloading. Here's a comparison of how long it takes for both servers to pick up a new WAR (and start the application) when it's dropped into their autodeploy directories.

  • Tomcat 6: 14-16 seconds
  • GlassFish 2: 9 seconds

The strange thing about Tomcat is it takes 6-8 seconds to recognize a new WAR has been deployed. Does Tomcat have a polling increment that can be increased during development?

Regardless, it's impressive that the GlassFish guys have made things that much faster for developers. Nice work folks!

These days, I try to use mvn jetty:run on projects. Then I don't have to worry about deploying, just save and wait for the reload. Time to wait for AppFuse 2.0 to reload using the Maven Jetty Plugin (version 6.1.5)? 7 seconds. Of course, it'd be nice if I could somehow get this down to 1 or 2 seconds.

Maybe Dave should use the Maven integration for Roller to decrease his reload times. ;-)

Posted in Java at Sep 19 2007, 04:55:31 PM MDT 18 Comments
Comments:

After reading your post, I remembered I did some tinkering getting Tomcat to reload a context when classes were recompiled. Looking back, there's an "unloadDelay" attribute you can specify for a context. Look at my post for more details:

I will definitely consider Glassfish for development in the future although lately I've been having too much fun with Ruby :P

Posted by Shane Witbeck on September 20, 2007 at 01:23 AM MDT #

re: "mvn jetty:run" ... I hope we will be able to do that type of things on the GFv3 branch soon. The basic mechanism is already there, as shown by the GlassFish v3 Gem.

re: Nice work folks! ... I agree. The whole development team and community have done a great job.

- eduard/o

Posted by Eduardo Pelegri-Llopart on September 20, 2007 at 01:36 AM MDT #

I have switch to Glassfish few months ago and since then my Tomcat become obsolete. Now that I'm developing JEE5 (ejb3 + jpa + jsf) application and feels just great working with Glassfish.

Posted by Kenneth Mark on September 20, 2007 at 02:58 AM MDT #

I never had a reason to use EJB, so I never had a reason to use glassfish, mvn jetty:run is perfect in most cases.

Posted by Kocka on September 20, 2007 at 11:44 AM MDT #

Hi all, I use the jetty layncher plugin, http://jettylauncher.sourceforge.net/ It works very well, and I can debug the code, make some changes, just save the editor and refresh the browser... the jetty doesn´t restart and I don´t lose the session. I don´t understand why a lot of people "mvn jetty:run"... Isn´t easier just to click in the Run/Debug button inside Eclipse? What´s the advantage of the mvn jetty:run? regards,

Posted by Ricardo on September 20, 2007 at 01:25 PM MDT #

Ricardo, I agree the Jetty Launcher is a nice solution. However, I tend to use IDEA more than Eclipse lately.

In both IDEs, it's pretty easy to setup an External Tool and icon that you can use to run "jetty:run". However, most of the time you don't need to restart Jetty.

Posted by Matt Raible on September 20, 2007 at 01:46 PM MDT #

GlassFish v2 has a hidden feature[1] that does something similar to what Jetty's Maven plugin. It is not as good as what Jetty does, but still interesting to use (at least I use it) :-)

-- Jeanfrancois
[1] http://weblogs.java.net/blog/jfarcand/archive/2006/01/fast_web_applic_1.html

Posted by Jeanfrancois Arcand on September 20, 2007 at 05:08 PM MDT #

With Jetty and Tomcat I get about 3 or 4 reloads before I get permgen errors and have to retart (appfuse based apps) I wonder if what other people are getting better results or if GlassFish is better doing this?

Posted by Ron Chan on September 20, 2007 at 08:33 PM MDT #

I've always used Jetty and been very happy with it. It's incredibly lightweight, designed for embedding and extremely fast. And with the creation of the new Jetty Http Client, there's no need to go anywhere else now for all my HTTP needs.

Posted by Bruce Snyder on September 20, 2007 at 11:55 PM MDT #

Glassfish looks very nice, and it would be on the top of my list to use if I'd do full JEE development. Been reading many good stories on it. I second that Jetty is great. Nowadays, I just start it up with a starter class rather then using the Jetty Eclipse plugin or mvn jetty:run. Very easy to setup, customize and debug (as I sometimes want to go into Jetty's bowels to figure out what is going on). That Jetty plugin (of which I'm a team member) should be rewritten. It should just package Jetty 6.x, and have a few very simple configuration options. Something you install and it works out-of-the-box. Unfortunately, I won't have time to do anything on the project until next year or so, and it seems that the new guys on the project almost immediately lost their interest after being let into the project.

Posted by Eelco Hillenius on September 22, 2007 at 11:24 PM MDT #

Ron: Do you modify the permgen size at startup, similar to Matt's startup options:
-XX:PermSize=512m -XX:MaxPermSize=512m
With such a parameter you should at least stretch the number of hot deploys before blowing up (perhaps by a factor of 4).

Posted by Tim Morrow on September 24, 2007 at 04:29 PM MDT #

[Trackback] This was certainly already an interesting comparison two years ago and still is now: ? GlassFish vs.

Posted by Mirror on October 03, 2007 at 11:05 PM MDT #

does glassfih supports other opensource scripting languages like php. perl by default or should we need to install any plgins

Posted by geetan on March 06, 2008 at 07:09 AM MST #

The Caucho folks have developed Quercus. It looks like they might have support for GlassFish.

Posted by Matt Raible on March 06, 2008 at 07:58 AM MST #

Really is Glass Fish is better than tomcat? how come! can u sight advantages & disadvantages of those two? like which is the easiest to configure ... & with little bugs! thnx :)

Posted by Earl on May 12, 2008 at 02:13 AM MDT #

but is not it kind of an apples and oranges comparison? glashfish is J2ee container and tomcat is just webapp server. IMHO, it would be more correct to do comparison between tomcat vs Grizzly (glashfish's webapp engine) .

Posted by levan on August 04, 2008 at 09:41 PM MDT #

How does GF compares with Tomcat when it comes to debugging and on the fly changes ? The Class change aware classloader was just awesome! Also, I notices that the GF is using the coyote adapter tomcat also uses are we sure we don't have an tomcat running in the back ? C

Posted by C on September 18, 2008 at 02:35 AM MDT #

The web container of GF v2 is an upgraded Tomcat 5.0.

Posted by 211.94.143.54 on October 30, 2008 at 07:28 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed