Hello all,

I'd like to state that I really have no experience on what are the best
default values for the cache parameters, so everyone may contribute and post
his/her experience on tuning these parameters.

Here's the explanation for the jboss.xml tags regarding the caches.

<cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-p
olicy>

This tag specifies the cache policy you want to use; actually 2 are
implemented, the above one and
org.jboss.ejb.plugins.NoPassivationCachePolicy. This tag is mandatory, ie
must always exist and be non empty.

Now the cache policy configuration. The following tags are not mandatory and
should have a default from standardjboss.xml if you don't specify them in
your jboss.xml.

NoPassivationCachePolicy doesn't have any configuration, so the
cache-policy-conf tag makes no sense for it.
LRUEnterpriseContextCachePolicy can be configurated.

<cache-policy-conf>

The tag that specify advanced settings.

        <min-capacity>5</min-capacity>

This is the minimum *capacity* of the cache. The cache can be empty, but
will have room for at least 5 beans (in this case); this value cannot be
less than 2; the resizer (see below) will shrink the cache capacity down to
but not less than this value.

        <max-capacity>200</max-capacity>

This is the maximum *capacity* of the cache. The cache can be empty, but
will have room for at most 200 beans (in this case); this value cannot be
less than the minimum capacity; the resizer (see below) will enlarge the
cache capacity up to but not more than this value.

        <overager-period>600</overager-period>

The overager is a periodic task that runs (in this case) every 600 seconds.
Purpose of this periodic task is to see if in the cache there are very old
beans, and to passivate them. The age at which a bean is considered too old
is also configurable (see below). While the period of this task is 600
seconds, the *first run* happens at a random time between 0 and 600 seconds
(in this case).

        <resizer-period>600</resizer-period>

The resizer is a periodic task that runs (in this case) every 600 seconds.
Purpose of this periodic task is to shrink / enlarge the cache *capacity*
upon 3 parameters (see below). While the period of this task is 600 seconds,
the *first run* happens at a random time between 0 and 600 seconds (in this
case).


        <max-bean-age>600</max-bean-age>

This is the max age a bean can have before being passivated by the overager
(in this case 600 seconds). See the overager above.

        <max-cache-miss-period>60</max-cache-miss-period>
        <min-cache-miss-period>1</min-cache-miss-period>
        <cache-load-factor>0.75</cache-load-factor>

These 3 parameters control the resizer in this way: the number of cache
misses is internally recorded. When the resizer runs, it sees what is the
cache miss rate from the last time it ran. If there is more than (in this
case) one cache miss every 1 second (min-cache-miss-period) then the resizer
tries to enlarge the cache; if there is less than (in this case) one cache
miss every 60 seconds (max-cache-miss-period) then the resizer tries to
shrink the cache. 
How much is the cache enlarged / shrinked ? Here is where the load factor
comes in the picture. When the resizer shrinks, it tries to shrink the cache
so that (in this case) the ratio number of beans / cache capacity is 0.75;
when the resizer enlarges, it tries to enlarge the cache by a factor 1 /
0.75 == 1.333 (in this case) plus a correction calculated from the cache
miss rate (ie the more cache miss rate you have, the more the cache is
enlarged, starting from at least 1.333; so if you really have a lot of cache
misses, the resizer may decide to enlarge the cache of a factor 2.0 instead
of 1.333 - if there is room for that).

Bye

Simon

Reply via email to