the corner office

a blog, by Colin Pretorius

« Lousy time to be a turkey | Main | Space Cadet »

Generalising the blog

In between all the studying and being a doting husband, I still sneak away now and then and tinker on the blog app. At first I'd tackle something on the TODO list and as I got stuck in, I'd end up adding another 5 items that needed looking at. Thankfully the list has slowly been whittled down to LATERs and DONEs.

I've spent quite a bit of time generalising the app. The blog wasn't initially intended for anything other than The Corner Office, but soon Ronwen was asking about setting up her own blog, and I wanted to keep a quick-and-dirty private diary / tech scribble blog. Some parts, like headings and link bars and the like were easy to do, but others got a bit tricky: the dynamic CSS styles functionality was partly hard-coded, ditto for RSS feeds mapped to blog categories and so on, and these needed some fancy footwork to be fully configurable.

Most of that is done. I've been going through a lot of the old code (the app was initially my learn-JSP project, and somewhat uh, dated), and cleaning up the bits that are too ugly for posterity. One problem I picked up yesterday, is how the blog handles some images. Most dynamic files and images are stored as BLOBs in the back-end database, but the front-end logos and whatnot were actual images in the web directory in the .war file. This made good sense performance-wise, because every page hit requiring a BLOB to be hauled out of the back-end database is not what I'd call desirable. Problem is, if the app is going to be virtuously generalised, then having to personalise the app by shovelling different images into the .war file isn't the way to go either.

I see two possible solutions. The first is to push more images back into the database, but cache the most used ones in memory. For small things like a logo or background images, which are going to be required for nearly every page hit, this is probably the best approach. The second alternative is to dump the images to a temp directory, and then stream the files from there. I think both solutions are better than BLOB-streaming, but I'm starting with the former approach for now, and in particular, want to be able to specify which images / files are cached or not. I'll keep this extensible so dumping to the file system is an option, eventually, too (more thoughts on that another time). So that's the next chunk of work to do.

{2007.02.06 - 00:06}

meta

-home-
about
disclaimer
tech blog

archives

rssfeed posts

© Colin Pretorius