Hibernate

I’ve just finished given this site a massive overhaul.

It’s got a new lick of paint, the old design had been around since the site launched in 2002 so a re-design was well overdue (a 4 year old design is ancient by Internet standards!).

It’s also had some major surgery under the hood too.

I’ve essentially ripped out the existing home-brewed persistence layer and replaced it with hibernate.

This really was as painful as it sounded and I wouldn’t really recommend it to anyone.

I did it for two reasons.

The main reason being that hibernate looks good on my CV. 🙂

The second reason was that my home-brew persistence layer was, errr, a bit shit.

My existing persistence layer was very simple, it read the entire database into its cache at start-up then never touched it again apart from writing new data (whereupon it refreshed its cache).

It’s a simple but effective approach.

However, it’s not particularly scalable and the site was feeling the strain as data grew.

Hibernate of course is a completely different animal.

Once I’d finished plumbing it in and got a working site I then set about making it efficient.

I didn’t want to replicate the old system of trying to cache everything, I wanted a balance between speed and memory usage.

This involved a lot of fine tuning, reading of the Hibernate manual and a copy of Hibernate In Action which I borrowed from work.

I think I have struck that balance now, the main sections of the site are read from the cache but the cache has limits set so that it doesn’t try to cache everything.

The other important thing I set up was a reporting page where I could view the sizes of the various caches to enable future tuning.

As for my thoughts on Hibernate – I’m reasonably happy with it.

When someone at work first told me about it they sang its praises to the limit and talked about its many powerful features and how it was so easy to work with.

They were sort of right, it is powerful, and does have some nice features. It’s also easy to work with. If you don’t care about performance.

If you want Hibernate to work efficiently and scale well you need to spend time learning how it works so that you can tune it properly.

I think I have done that to some degree but I’ll be monitoring cache performance over the coming weeks to see how it shapes up.

3 thoughts on “Hibernate”

  1. The redesign looks really nice mate, though I’m generally not a fan of pink :-p It’d be cool if the right column colour cycled randomly, but hey, I’m an ideas man, not a coder.

  2. All this, of course, would assume that there are a huge number of people reading your blog !?!

    Well you probably didn’t know that I was one, so that’s a surprise.

  3. Good to know that I have at least two readers.
    Thanks guys!

    Random colours are a good idea, or themed (like the old version of the site), or different per section.
    I’ll have a play.

    And what’s wrong with pink! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *