The Golden Wombat of Destiny
The Golden Wombat of Destiny was a text adventure game (interactive fiction) written by Huw Collingbourne in early `80s. I honestly never got very far in that game, preferring Colossal Cave and The Hitchhiker’s Guide to the Galaxy in the days of the Kaypro IV.
Today we’re going to talk about a different wombat, with a different destiny.
Spear-headed by Brian McCallister, mod_wombat embeds the Lua programming language into the Apache HTTP server in the same fashion as mod_perl, mod_php and mod_python bring their respective languages into the Apache world of web development.
How mod_wombat differs has a lot to do with how Lua differs from other languages. Lua is a very lightweight scripting language originally designed for non-programmers to customize the software it is embedded in. It is simple to pick up, while offering a good amount of flexibility and power. Its popularity in game scripting has pushed its’ interpreter towards being very efficient and multi-thread ready.
Apache is the heavy-weight champion of HTTP servers, responsible for serving up half the Internet. Apache 2.x was a substantial reworking, providing:
- The Apache Portable Runtime (APR) so Module writers don't need to deal with all the OS-specific issues.
- Swappable multi-processing modules (MPMs) including Prefork (non-threaded), Worker threads, and an Event MPM that decouples server threads from the HTTP connection (read: very efficient).
Lua is designed for embedding in C-based programs, which allows mod_wombat to take advantage of the substantial infrastructure Apache provides. More than any other language module, mod_wombat endeavors to work with Apache.
Matthew Burke is looking for students to work on mod_wombat as part of the 2008 Google Summer of Code. If you are a student who is interested, you should definitely get in touch with Matthew Burke and Brian McCallister to discuss your ideas. Who knows, this could be your destiny? :-)
This is gonna be great
Lua atop Apache could make for a very sweet development platform for web applications, both large and small.
- Lua is simpler than other scripting languages used for web development, making it easy to pick-up. This is exemplified by the use of tables as a universal data structure (like PHP Arrays, but unlike Python or Ruby).
- There is a fairly clean slate to start with, meaning it doesn't carry the baggage of hundreds of procedural methods like PHP, or code mixed into HTML templates. APIs can be nicely organized and designed for simplicity (i.e. ColdFusion's DateFormat and TimeFormat make it easier to reason about date formatting than Ruby or PHP's methods).
- Apache's efficient threading modules combined with Lua's low-overhead and thread-safety make for a very performant platform. That means it is able to handle a load of traffic without a huge hardware investment.
- Deploying with an Apache module is often the preferred method, as opposed to more complicated reverse proxy setups or FastCGI. For ease of deployment, this is an advantage over the popular Ruby platform, which has no true mod_ruby.
- The mod_wombat project was started by Apache Software Foundation members, is hosted with Apache, and has their backing as a supported module for Apache users.
If you are a student joining the GSoC, you will need to come up with your own proposal. I’m not a student, so I don’t qualify, but I will post here a few of the basic ideas that I believe are of general consensus.
For mod_wombat to become a platform of choice, it needs to be dead-simple to deploy, whether as a development environment or a production server. This would be served by relying only on those modules included with the Apache distribution.
There has been a desire to remove the dependency on libapreg2, which is used to parse HTTP cookies, query-strings and POST data. The required functionality would need to be incorporated into mod_wombat directly.
Tighter integration with Apache HTTP Server 2.2
There is a lot that can be done to further integrate Lua with Apache, whether using Lua to configure Apache, or to pull Apache functionality into Lua.
Perhaps the most significant and obvious, would be integration with Apache’s Database Framework. With DBD, the database drivers for your web application are bundled with Apache, and Apache manages a pool of database connections in an intelligent way appropriate for the MPM being used. With mod_wombat, Lua could be the first language to really take advantage of this feature, new to Apache 2.2.
Write something with it
What mod_wombat provides is an API to higher-level web frameworks and applications. It’s hard to know how those APIs should be written without using them. Building a small project atop mod_wombat could go a long way in designing a concise and friendly API.
Preferably using some sort of code standards.
If you choose to partake in this endeavor, there a few things you must know.
- Working knowledge of ANSI C, perhaps C: A Reference Manual will help.
- Programming in Lua is an excellent resource for both the Lua programming language and how to interface it with C.
- The Apache Modules Book goes over Apache's architecture and writing Modules for it, including a chapter on DBD.
- A willingness to work with autoconf and related build tools. There is but one book dedicated to the subject, and the online version is more up-to-date.
- Familiarity with existing web development environments and experience with database systems.
- An understanding of just how Google Summer of Code works.
- Go through Brian's slides and download the source code from Subversion to familiarize yourself with mod_wombat.
And that’s all there’s to it. Ready to get coding?
Maxime Petazzoni has accepted the role of working on mod_wombat for GSoC this year. See the Apache mailing list.