Simple Blog Optimizations for JBoss

08 April 2004

I've been tuning my blog for JBoss recently, and hopefully you can feel it a bit in this site's load time.

JBoss 3.2.3 has a little bug causing it to always write dates back to the database, even though they didn't change after every transaction. I noticed even on my dual Athlon, this could take a full second to commit everything back.

Instead of installing the a 3.2.4RC version of JBoss or patching up the source myself, I just tagged all my getter methods as read-only: @jboss.method-attributes read-only = "true" (in Xdoclet).

Additionally, I merged in a container config which enables commit-option A (allows more caching, since JBoss can assume the database won't change out from under it). Lastly, I enabled read-ahead on find. This causes more data to be read, but it does it in fewer queries. The values are loaded now in the single find statement, not in subsequent load queries. (@jboss.read-ahead strategy = "on-find")


Filed Under: Blog-Code Java