Main Contents

Hashbelts Live On!

William Grosso @ May 9, 2006

A little over four years ago, I wrote a series of articles deriving and describing a new datastructure (and associated algorithm) which I called a Hashbelt. Hashbelts have many nice properties. For one thing, they're easy to implement in almost any modern language. For another, they've also got some performance characteristics which make them close to ideal for a wide variety of caching algorithms.

When I wrote up the hashbelt articles, I expected the Java universe to immediately adopt the algorithm. It's clean, it's obviously better than what people were using, and the explanations were darn thorough :-). I especially expected the authors of Tomcat's session handling code, which I dissected in those articles, to turn away from bad practices and move towards the light.

They didn't, of course (and still haven't. Tomcat 5.5 is still doing session expiration incorrectly). And, aside from a few e-mails that I got over the next two years, it felt as if the algorithm had died without a trace.

That bothered me a little at first, but I was way too busy helping Hipbone achieve a happy ending to worry about whether my little algorithm was making it in the world. And so I kind of forgot about Hashbelts for a while.
But, recently, I've been doing a deep dive into Python.

Why? Basically, I strongly believe that, every now and then, if you want to work on the technological side of the startup house, you have to go back to basics and understand the next generation of core technologies. I've been mostly surface-to-middling level for the past couple of years; I've acquired a reasonable understanding of a lot of different technologies, and I've watched closely as my developers experimented. I've gotten vicarious knowledge about how painful it can be to adopt JSF before it's fully baked, and I've even helped organize a Ruby Conference. But I haven't really done a deep dive into any of the dynamic languages (by which I mean: Python, Ruby, and Lisp).

And, at the end of the day, I have to. Without some level of actual experience, it's very difficult to do things like estimate risk or assert, with confidence, that you're using the right technology (or, for that matter, building the right application). This has been driven home to me over the past couple of months– I've run into more than a few startups that are using the wrong technology. They've got people, they've got funding, and they're going to either switch horses or fail.

To help me understand the quality of the Python libraries and get a gut level feel for how clean Python code is (and how hard it is to do things), I'm writing some simple servers using Twisted. And to understand both how Twisted does things and how threading works in Python, I'm porting the Hashbelt library.

Which leads to today's feelgood moment. As I've been thinking about Hashbelts, I idly began to wonder if anyone had ever adopted it. And the result of searching the web was very nice: I found out that my little algorithm has been adopted in a bunch of places (for example, in Castor and in the early versions of Hibernate).

It feels good to know that people are using Hashbelts. Surprisingly good.

Filed under: Career, Java, Oldies but Goodies | Share on Facebook

Leave a comment