By Zed A. Shaw

Mongrel2 v1.6 Released, Tons Of Improvements

It's been a full 5 months since I released the 1.5 version of Mongrel2 so I'm very pleased to announce version 1.6 of Mongrel2 is ready. This release includes a ton of bug fixes and then new internal features that lay the foundation for some big changes to mongrel2 in the following releases.

You can grab the latest source .tar.bz2 at:

http://mongrel2.org/static/downloads/mongrel2-1.6.tar.bz2 (MD5: 4b7467c17dcd192e574d4d2c1455997c)

I've been running this release on my sites for a while, so it should be stable, but please report any bugs you find as a new bug ticket so we can fix them.

Tons Of Bugs

Well first off, there's a whole mess of bugs that piled up during the 5 months I didn't have time to hack on Mongrel2. Those are all fixed and there's only a few left that remain. The biggest bugs fixed were related to reloading the server and getting that tight, thanks to a few companies that are using Mongrel2 in various rapid deployment scenarios. I went so far as to run tests off twitter where I'd reload the mongrel2 server I used while people were slamming the server to see if it stayed up.

Mongrel2 is also updated to require the latest ZeroMQ 2.1.4 and now works with it very well. You should not use ZeroMQ 2.1.6 because of a bug in ZeroMQ for that release.

New Features

For features there's three big ones:

  • A new TNetString based protocol transport for the headers that should be a lot faster than JSON and safer. We came up with TNetStrings because we found generating JSON was slow and error prone, and really wanted a nice fast easy to parse protocol for a lot of the internal communications. As we go through all the different handlers out there we'll be wiring up TNetStrings support for people.
  • A totally revamped fully programmable control port. The control port now uses TNetStrings completely, which simplifies it, but also means that you can write code against it and fully automat a Mongrel2 server.
  • Lots of new control port commands for getting server info, exact status, with more to come.
  • A new flexible timeout mechanism with settings for timeouts based on activity, read rates, and write rates. You can also disable this and then use the control port to write your own if you need an even fancier logic.
  • Revamped manual using Dexy so that we get full syntax coloring on all the code examples and generating the manual is even easier. Eventually the manual will be part of the test/release cycle and will run certain unit tests and scripts automatically to generate content and outputs included in the manual.
  • Better socket management that's dynamically allocated so it can be exapnded to any size (previously it was fixed), and also includes a whole bunch of new statistics that Mongrel2 tracks so you can manage and monitor connections. Included are last read/write times, read/write bytes transfered, last ping activity, states a socket is in, task states. With this you should be able to peek inside Mongrel2 and fully manage it's internal operations.
  • Routing was formalized more clearly, cleaned up, and then I wrote a full explanation of how it works.

Planned Features For 1.7

The three big features I want to do for 1.7 are:

  1. Better SSL support with good docs, probably ditching axTLS and going with GnuTLS instead. Looks like axTLS isn't going to work out so we'll just ditch it and use something else. There's also an offer now to support this feature with a bounty from one of the donors so it'll probably get done.
  2. WebSockets support using the latest hybi-07 protocol specification. This is finally a proper specification that I actually want to implement.
  3. Filters that will let you write C .so loadable modules to modify how Mongrel2 operates.

Obviously we'll also be still cranking on the manual, fixing bugs, as the above gets implemented, so fill out a ticket if you've got a feature or join the [email protected] mailing list to talk about it.

Planned Features For 1.8

I don't want to get too far ahead, but there is one big feature I'm planning for 1.8 that I thought I should mention.

Now that there's full TNetStrings support inside Mongrel2, it's very trivial to write simple RPC mechanisms to control the server. The current control port is basically doing this, and the end results are working great for automated deployment and management.

In 1.8 I want to do this with the configuration subsystem so that Mongrel2 can be configured from anything. I'll define a protocol that a "config server" has to follow which will simply be queries for things Mongrel2 needs to know as 0mq+tnetstrings messages. The config server then just replies with what that server needs. By default this will just be from the current SQLite3 database we use, but you'll be able to point mongrel2 at a different 0mq server to make it reconfigure.

With that in place I'll write a few config servers in Python as examples that configure mongrel2 using files, redis servers, couchdb, etc. to show how it can adapt to the management needs of a large scale automated deployment.

Should be fun.