User: simone  
  Date: 00/10/27 03:29:15

  Modified:    .        contconf_howto.html
  Log:
  Added advanced cache configuration howto
  
  Revision  Changes    Path
  1.3       +107 -18   jbossweb/contconf_howto.html
  
  Index: contconf_howto.html
  ===================================================================
  RCS file: /products/cvs/ejboss/jbossweb/contconf_howto.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- contconf_howto.html       2000/09/26 02:12:11     1.2
  +++ contconf_howto.html       2000/10/27 10:29:15     1.3
  @@ -1,18 +1,28 @@
  -<html>
  -<head>
  -<title>
  -Container Configuration
  -</title>
  +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
  +<head><TITLE>Container Configuration</TITLE>
  +<META content="text/html; charset=unicode" http-equiv=Content-Type>
  +<META content="MSHTML 5.00.2920.0" name=GENERATOR>
   </head>
  +<BODY>
   
   <font face=arial,helvetica size=+3 color="#ffcc00"> 
   What is a Container Configuration?
   </font> 
   
  -<p>When you deploy an application, jBoss creates a container for each of your 
beans. This container will be used only for this particular bean. It must be 
configured according to the type of the bean (CMP Entity Bean, Stateful Session Bean, 
...). Different configurations are stored in the <em>standardjboss.xml</em> file. You 
may provide additional custom configurations in the <em>jboss.xml</em> file for your 
application.</p>
  +<p>When you deploy an application, jBoss creates a container for each of your 
beans. This container will be used only for this particular bean. It must be 
configured according to the type of the bean (CMP Entity Bean, Stateful Session Bean, 
etc.). Different standard configurations are stored in the <em>standardjboss.xml</em> 
file. You may provide additional custom configurations in the <em>jboss.xml</em> file 
for your application.</p>
  +<P>
  +<font face=arial,helvetica size=+2 color="#ffcc00">Container Configuration 
Outline</font>
  +<ul>
  +<li><A href="#StdConf">Standard Configurations</a>
  +<li><A href="#jdk12Conf">How do I configure my bean for jdk1.2.2 clients?</a>
  +<li><A href="#CustConf">How do I specify my own custom configuration ?</a>
  +<li><A href="#CacheConf">How do I specify advanced cache configuration ?</a>
  +<li><A href="#WhatConf">What can be configured ?</a></li>
  +</ul>
  +<p>&nbsp;<p>
   
   <ul>
  -<li><b>Standard Configurations</b><br>jBoss currently provides a standard 
configuration for each type of bean. These configurations are stored in the 
<em>standardjboss.xml</em> file. There are currently 8 standard configurations. If you 
don't provide anything else (as we advise you to do, at least at the beginning), jBoss 
will automatically choose the right standard configuration for your container. The 
available configurations are the following: <ul><tt>
  +<li><a name="StdConf"></a><b>Standard Configurations</b><br>jBoss currently 
provides a standard configuration for each type of bean. These configurations are 
stored in the <em>standardjboss.xml</em> file. There are currently 8 standard 
configurations. If you don't provide anything else (as we advise you to do, at least 
at the beginning), jBoss will automatically choose the right standard configuration 
for your container. The available configurations are the following: <ul><tt>
   <li>Standard CMP EntityBean
   <li>Standard BMP EntityBean
   <li>Standard Stateless SessionBean
  @@ -21,10 +31,12 @@
   <li>jdk1.2.2 BMP EntityBean
   <li>jdk1.2.2 Stateless SessionBean
   <li>jdk1.2.2 Stateful SessionBean
  -</tt></ul>
  +</tt></li>
  +
  +</ul>
   <p>The first four ones are used if you run <b>jBoss</b> with a jdk1.3 JVM. The four 
last ones are used if you run <b>jBoss</b> with a jdk1.2.2 JVM.</p>
   
  -<li><b>How do I configure my bean for jdk1.2.2 clients?</b><br>If you run jBoss on 
a jdk1.3 JVM, but your clients use jdk1.2.2, the standard configuration won't work 
(the protocols are not backward compatible). In this case, you have to force jBoss to 
use the corresponding jdk1.2.2 configuration. You do that by providing a 
<em>jboss.xml</em> file. This file must be in the <em>META-INF</em> directory of your 
jar file, along with <em>ejb-jar.xml</em>. In the section for your bean, simply add a 
<tt>&lt;configuration-name&gt;</tt> tag. Your xml files will look like this (note that 
the <tt>&lt;ejb-name&gt;</tt> tags in the 2 xml files must match)
  +<li><a name="jdk12Conf"></a><b>How do I configure my bean for jdk1.2.2 clients 
?</b><br>If you run jBoss on a jdk1.3 JVM, but your clients use jdk1.2.2, the standard 
configuration won't work (the protocols are not backward compatible). In this case, 
you have to force jBoss to use the corresponding jdk1.2.2 configuration. You do that 
by providing a <em>jboss.xml</em> file. This file must be in the <em>META-INF</em> 
directory of your jar file, along with <em>ejb-jar.xml</em>. In the section for your 
bean, simply add a <tt>&lt;configuration-name&gt;</tt> tag. Your xml files will look 
like this (note that the <tt>&lt;ejb-name&gt;</tt> tags in the 2 xml files must match)
   
   <p>
   <em>ejb-jar.xml</em>:</p>
  @@ -60,7 +72,7 @@
   </pre></td></tr></table></p>
   
   
  -<li><b>How do I specify my own custom configuration?</b><br>You may want to provide 
your own advanced configuration. For example, you may want to increase the size of 
your pool, or use a different instance cache. To do this, you must define your 
configuration in <em>jboss.xml</em> in the <tt>&lt;container-configurations&gt;</tt> 
tag. Then you have to use your new configuration in the bean section of your 
<em>jboss.xml</em> file. For example, if you want to log calls to your bean, your file 
will look like this : 
  +<li><a name="CustConf"></a><b>How do I specify my own custom configuration 
?</b><br>You may want to provide your own advanced configuration. For example, you may 
want to increase the size of your pool, or use a different instance cache. To do this, 
you must define your configuration in <em>jboss.xml</em> in the 
<tt>&lt;container-configurations&gt;</tt> tag. Then you have to use your new 
configuration in the bean section of your <em>jboss.xml</em> file. For example, if you 
want to log calls to your bean, your file will look like this : 
   
   <p><table border=0 bgcolor="#80ff80" cellspacing=4><tr><td><pre>
   &lt;jboss&gt;                                                               
  @@ -76,7 +88,7 @@
         &lt;container-name&gt;<b>Logging Configuration</b>&lt;/container-name&gt;
         &lt;call-logging&gt;true&lt;/call-logging&gt;
         
&lt;container-invoker&gt;org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker&lt;/container-invoker&gt;
  -      
&lt;instance-cache&gt;org.jboss.ejb.plugins.NoPassivationStatefulSessionInstanceCache&lt;/instance-cache&gt;
  +      
&lt;instance-cache&gt;org.jboss.ejb.plugins.StatefulSessionInstanceCache&lt;/instance-cache&gt;
         
&lt;persistence-manager&gt;org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager&lt;/persistence-manager&gt;
         &lt;transaction-manager&gt;org.jboss.tm.TxManager&lt;/transaction-manager&gt;
         &lt;container-invoker-conf&gt;
  @@ -87,8 +99,86 @@
     ...
   &lt;/jboss&gt;
   </pre></td></tr></table></p>
  +
  +<li><a name="CacheConf"></a><b>How do I specify advanced cache configuration 
?</b><br>
  +jBoss currently provides the possibility to choose the cache configuration for each 
container configuration.
  +You may want to define your own cache settings, and to do so you must specify them 
in <EM>jboss.xml</EM> under 
  +the <tt>&lt;instance-cache&gt;</tt> tag and subtags.
  +Currently 2 cache algorithms have been implemented: a no passivation cache 
algorithm (so that all the bean
  +are kept in memory, unless the bean is an entity bean and you specified for it 
commit option C), and a
  +least recently used (LRU) cache algorithm (so that bean less frequently used are 
passivated to save 
  +server resources).<br>
  +Let's see how to configure both caches. The examples below are about entity beans, 
but the cache settings applies as well for stateful session beans.<p>
  +For the no passivation cache, <EM>jboss.xml</EM> will look like this:<br>
  +<table border=0 bgcolor="#80ff80" cellspacing=4><tr><td><pre>
  +&lt;jboss&gt;                                                               
  +  &lt;enterprise-beans&gt;
  +    &lt;entity&gt;
  +      &lt;ejb-name&gt;Bean A&lt;/ejb-name&gt;
  +      &lt;configuration-name&gt;No Passivation 
Configuration&lt;configuration-name&gt;
  +    &lt;/entity&gt;
  +  &lt;enterprise-beans&gt;
  +  ...
  +  &lt;container-configurations&gt;
  +    &lt;container-configuration&gt;
  +      &lt;container-name&gt;No Passivation Configuration&lt;/container-name&gt;
  +      ...
  +      
&lt;instance-cache&gt;org.jboss.ejb.plugins.EntitySessionInstanceCache&lt;/instance-cache&gt;
  +      &lt;container-cache-conf&gt;
  +        
<b>&lt;cache-policy&gt;org.jboss.ejb.plugins.NoPassivationCachePolicy&lt;/cache-policy&gt;</b>
  +      &lt;/container-cache-conf&gt;
  +      ...
  +    &lt;/container-configuration&gt;
  +  &lt;/container-configurations&gt;
  +  ...
  +&lt;/jboss&gt;                                                               
  +</pre></td></tr></table></br>
  +No further settings are available for the no passivation cache.<p>
  +For the LRU cache, <EM>jboss.xml</EM> will look like this:<br>
  +<table border=0 bgcolor="#80ff80" cellspacing=4><tr><td><pre>
  +&lt;jboss&gt;                                                               
  +  &lt;enterprise-beans&gt;
  +    &lt;entity&gt;
  +      &lt;ejb-name&gt;Bean A&lt;/ejb-name&gt;
  +      &lt;configuration-name&gt;LRU Configuration&lt;configuration-name&gt;
  +    &lt;/entity&gt;
  +  &lt;enterprise-beans&gt;
  +  ...
  +  &lt;container-configurations&gt;
  +    &lt;container-configuration&gt;
  +      &lt;container-name&gt;LRU Configuration&lt;/container-name&gt;
  +      ...
  +      
&lt;instance-cache&gt;org.jboss.ejb.plugins.EntitySessionInstanceCache&lt;/instance-cache&gt;
  +      &lt;container-cache-conf&gt;
  +        
<b>&lt;cache-policy&gt;org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy&lt;/cache-policy&gt;
      
  +        &lt;cache-policy-conf&gt;
  +          &lt;min-capacity&gt;5&lt;/min-capacity&gt;
  +          &lt;max-capacity&gt;200&lt;/max-capacity&gt;
  +          &lt;overager-period&gt;300&lt;/overager-period&gt;
  +          &lt;max-bean-age&gt;600&lt;/max-bean-age&gt;
  +          &lt;resizer-period&gt;400&lt;/resizer-period&gt;
  +          &lt;max-cache-miss-period&gt;60&lt;/max-cache-miss-period&gt;
  +          &lt;min-cache-miss-period&gt;1&lt;/min-cache-miss-period&gt;
  +          &lt;cache-load-factor&gt;0.75&lt;/cache-load-factor&gt;
  +        &lt;/cache-policy-conf&gt;</b>
  +      &lt;/container-cache-conf&gt;
  +      ...
  +    &lt;/container-configuration&gt;
  +  &lt;/container-configurations&gt;
  +  ...
  +&lt;/jboss&gt;                                                               
  +</pre></td></tr></table></br>
  +The tag <tt>&lt;cache-policy-conf&gt;</tt> and its subtags are optional, so you can 
specify none, few or all of them.<br>
  +The tag <tt>&lt;min-capacity&gt;</tt> specifies the minimum capacity of the cache. 
The cache can be empty, but will have room for at least 5 beans (in the above 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.<br>
  +The tag <tt>&lt;max-capacity&gt;</tt> specifies the maximum capacity of the cache. 
The cache can be empty, but will have room for at most 200 beans (in the above 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.<br>
  +The tag <tt>&lt;overager-period&gt</tt> specifies the period of the 
<b>overager</b>, that is a periodic task that runs (in the above case) every 300 
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 300 seconds, the first run 
happens at a random time between 0 and 300 seconds.<br>
  +The tag <tt>&lt;max-bean-age&gt;</tt> specifies the max age a bean can have before 
being passivated by the overager (in this case 600 seconds).<br>
  +The tag <tt>&lt;resizer-period&gt;</tt> specifies the period of the <b>resizer</b>, 
that is a periodic task that runs (in the above case) every 400 seconds. Purpose of 
this periodic task is to shrink / enlarge the cache capacity upon 3 other parameters 
(see below). While the period of this task is 400 seconds, the first run happens at a 
random time between 0 and 400 seconds.<br>
  +The tags <tt>&lt;max-cache-miss-period&gt;</tt>, 
<tt>&lt;min-cache-miss-period&gt;</tt> and <tt>&lt;cache-load-factor&gt;</tt> 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 the above 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 the above case) plus a 
correction calculated from the cache miss rate (so that 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).<br>
  +<br>
   
  -<li><b>What can be configured?</b><br>These are the different things you can 
customize in a <tt>&lt;container-configuration&gt;</tt> tag in <em>jboss.xml</em>. See 
the <a href="jboss.dtd">jboss.xml DTD</a> for more details: <ul>
  +<li><a name="WhatConf"></a><b>What can be configured ?</b><br>These are the 
different things you can customize in a <tt>&lt;container-configuration&gt;</tt> tag 
in <em>jboss.xml</em>. See the <A href="jboss.dtd">jboss.xml DTD</A> for more details: 
<ul>
   <li><tt>call-logging</tt>: this tag must have a boolean value: true or false. It 
tells the container if calls to this bean must be logged or not. It is set to false in 
standard configurations.
   <li><tt>container-invoker</tt>: the container invoker is .
   <li><tt>instance-pool</tt>: the instance pool is a set (a "pool") of free (ie not 
currently associated to a context) instances of the bean. When an instance of the bean 
is no longer used, it is thrown back to the pool. This is not used for Stateful 
Session Beans, since the instances are not reusable.
  @@ -98,10 +188,9 @@
   <li><tt>container-invoker-conf</tt>: configuration of the container invoker.
   <li><tt>container-cache-conf</tt>: configuration of the cache. For example, you may 
specify the time interval between passivations.
   <li><tt>container-pool-conf</tt>: configuration of the pool. Mainly, the size of 
the pool.
  -<li><tt>commit-option</tt> must be A, B or C. See the ejb specification for more 
details.
  -</ul>
  -
  -</ul>
  -<hr>Author: <a href="mailto:[EMAIL PROTECTED]">S�bastien Alborini</a>
  -</body>
  +<li><tt>commit-option</tt> must be 
  +    A, B or C. See the ejb specification for more details.</li>             
  +</ul></li></UL>
  +<hr>Author: <A href="mailto:[EMAIL PROTECTED]">S&eacute;bastien 
Alborini</A> 
  +</BODY>
   </html>
  
  
  

Reply via email to