Daily: First Optimization Pass

F-18 Super HornetAs you might have noticed, Daily had zero optimization until now. This means every page was rendered fresh all the way from database and back, each page request needing multiple database queries to put the page together.
In this first pass, which took me 6 hours of serious huffing and puffing smile_wink, I picked off naked dogs in the DAO layer which is now starting to shape up nicely using WhirlyCache, a fast lightweight java cache library. Same was done for uploaded images. While I was at it, I slipped in transaction layer to make application-level operations atomic and to prevent (well, reduce) database integrity corruption. Unlike what I said before, I opted to use Spring Framework's AOP-based transaction framework instead of using iBATIS DAO library. Using java annotation to mark transactional classes and methods, Spring was easy to use and reasonably portable. I unfortunately didn't have much time to work on reported bugs. Oh, well.
Anyhow, result of this first pass is not bad but I've got two more optimization passes planned before moving on to fleshing out the other half of Daily, over page generation level using OSCache and another at HTTP level. After the third pass, average number of database queries per page should drop well below 1.
It's fun making things fly with minimal effort.

Tags: ,
Advertisements