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.