I'm trying to figure out how to tune the stateful session bean's cache
parameters.
The sun-ejb-jar.dtd offers the following tuning parameters:
max-cache-size
resize-quantity
cache-idle-timeout-in-seconds
removal-timeout-in-seconds
victim-selection-policy
The explanation of the "resize-quantity" element is:
1. according to AS91ADG.pdf, which I downloaded here:
http://wiki.glassfish.java.net/Wiki.jsp?page=ApplicationDeplyomentGuide
-> Specifies the number of beans to be created if the pool is empty
(subject to the max-pool-size limit).
2. according to sun-ejb-jar_3_0_0.dtd in GF's lib/dtd dir:
-> resize-quantity specifies the number of beans to be created or
deleted when the pool or cache is being serviced by the server.
3. according to the steps to configure EJB cache settings at:
https://glassfish.dev.java.net/javaee5/docs/AG/ablms.html#ablnc
-> When the maximum number of cached beans is reached, the container
removes this number of passivated beans from the backup store.
Explanation 1. obviously refers to the "resize-quantity" element under
bean-pool (for SLSBs, EBs and MDBs), and not to the cache. But what do
the explanations of 2. and 3. mean?
And how about the "victim-selection-policy" element? I thought bean
instances would be removed immediately when either of the following
occurred:
- @Remove or remote.remove() is called
- times out (cache-idle-timeout-in-seconds) (for beans whose methods are
not invoked again fast enough, write state to file for later retrieval)
- times out (removal-timeout-in-seconds) (for clients that forget to
call remove())
The only meaning I can come up is this:
After many clients create SFSBs and call their business methods, the
instances (containing state) move to the cache. When there are more
instances than max-cache-size, the victim-selection-policy is used to
pick a few instances to passivate (write state to file) and remove the
instances.
Is that right?
And at what timing are instances used from the cache? Only at activation
time (original instance had been destroyed so some idle instance is
reused and loads the state from file) or also for requests from new clients?
Any info or reference to a good guide appreciated..
Thanks,
Dies