Tuesday, January 27, 2009
Something that may be of interest to Open Source enthusiasts is the recent release of the Open Google Servlet Engine (OpenGSE). Once upon a time engineers within Google developed their own fast, lightweight servlet engine which we inside Google refer to as simply the "Google Servlet Engine" or GSE. Many of Google's products, both internal and public facing, use the GSE, including GMail and Google Calendar. The OpenGSE code base conceptually consists of an inner-core which focuses on raw HTTP processing and a shell which wraps that inner core and implements the so-called "servlet container" abstraction. This approach was taken originally just because it made the coding easier, but it was found that this servlet container layer can wrap our internal corporate version, the Google Servlet Engine, and enable it to provide the same servlet container support as OpenGSE! While we weren't anticipating this outcome, it was an excellent unintended side effect and will help improving the functionality of our internal systems, as well.
While opening the code and removing all Google specific dependencies, it was necessary to ensure that the code base still behaved like a servlet engine: invalidated sessions are unable to store objects, etc.. We started with Watchdog, a then dormant test suite that only checks servlet spec 2.3 (to some extent). We decided to investigate how difficult it would be to add a few extra tests to test the features in the 2.5 spec. The tests were added and the code-base was tweaked further to pass those tests. The client-side of the original watchdog tests consisted of a custom ANT task which writes results to System.out. All of these client-side custom ANT task invocations were transformed into individual JUnit test methods which makes IDE development much, much easier and more pleasurable.
During a casual conversation with some of my fellow engineers, they suggested that perhaps the best way to think of OpenGSE is as a suite of servlet engine tests with a "reference servlet engine" that passes these tests. The "toy" servlet engine supplied with the test suites would have the same core http processing code (as far as possible) as the servlet engine which powers GMail etc. For folks outside of Google, there's really no compelling argument to drop Apache Tomcat/Jetty, etc. in favor of OpenGSE's reference servlet engine, but anyone interested in servlet engines would have a fantastic learning resource available to them. For Googlers, using a servlet-layer wrapped internal GSE for their project means that future Open Sourcing of their project becomes that much easier.
Special thanks goes to Mike Jennings who took the initiative, led this Open Source project throughout 2007-2008 and managed to get the first version of OpenGSE out in 2008, as well as Spencer Kimball and Peter Mattis, the two original authors of GSE.
We hope that you will find OpenGSE as useful as we have. Check out the code and send us your feedback in our Discussion Group.
Ed. Note: Updated post to clarify the terminology used.