<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:db="http://docbook.org/ns/docbook" xml:lang="en" xml:id="ejb.session.tuning"><info><title>Tuning EJB 2.1 session beans</title></info>
  

  <para>JOnAS handles a pool for each stateless session bean. The pool can be
  configured in the JOnAS-specific deployment descriptor with the following
  tags:</para>

  <itemizedlist>
    <listitem>
      <para>min-pool-size</para>

      <para>This optional integer value represents the minimum instances that
      will be created in the pool when the bean is loaded. This will improve
      bean instance creation time, at least for the first beans. The default
      value is 0.</para>
    </listitem>

    <listitem>
      <para>max-cache-size</para>

      <para>This optional integer value represents the maximum of instances in
      memory. The purpose of this value is to keep JOnAS scalable. The policy
      is the following: At bean creation time, an instance is taken from the
      pool of free instances. If the pool is empty, a new instance is always
      created. When the instance must be released (at the end of a business
      method), it is pushed into the pool, except if the current number of
      instances created exceeds the max-cache-size, in which case this
      instance is dropped. The default value is no limit.</para>
    </listitem>
  </itemizedlist>

  <example><info><title>Example</title></info>
    

    <para><screen> &lt;jonas-ejb-jar&gt;
    &lt;jonas-session&gt;
      &lt;ejb-name&gt;SessSLR&lt;/ejb-name&gt;
      &lt;jndi-name&gt;EJB/SessHome&lt;/jndi-name&gt;
      &lt;max-cache-size&gt;20&lt;/max-cache-size&gt;
      &lt;min-pool-size&gt;10&lt;/min-pool-size&gt;
    &lt;/jonas-session&gt;
  &lt;/jonas-ejb-jar&gt;
  </screen></para>
  </example>
</section>