[942174 views]

[]

[toggle ads]

Odi's astoundingly incomplete notes

New entries | Code

Memory use of the JBoss DB statement cache

JBoss *-ds.xml files let you define a statement cache for PreparedStatement objects:
<prepared-statement-cache-size>16</prepared-statement-cache-size>
Be not too adventurous with the value you set there! In one of my production systems I had a pool of 50 Oracle connections and 256 statement cache (per connection). That leads to 12'800 cached statements. Those statement objects must be surprisingly large, as cutting the value down to 16 from 256 immediately led to 1GB less heap use! That gives around 90KB per statment object.

The tricky thing is that the memory will not be used until your server uses many connections. That means when your load is high. That's exactly the situation when you simply can't spend memory on silly caches.

posted on 2011-09-21 16:02 CEST in Code | 0 comments | permalink