Sunday 1 September 2013

JBoss AS 7.1.1.Final. EJB Pooling.

This article shows how to stablish the EJB instantiation in JBoss 7.1.1.Final. From a performance point of view, it must be thought how many instances of a stateless bean must be alive at the same time along the application lifecycle.

This article is focused on the standalone JBoss execution mode.

In order to change the maximum number of instances that the application server manage, the following part of the JBOSS_HOME\standalone\configuration\standalone.xml must be changed:

<subsystem xmlns="urn:jboss:domain:ejb3:1.2">

            <session-bean>

                <stateless>

                    <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>

                </stateless>

                <stateful default-access-timeout="5000" cache-ref="simple"/>

                <singleton default-access-timeout="5000"/>

            </session-bean>

            <pools>

                <bean-instance-pools>

                    <strict-max-pool name="slsb-strict-max-pool" max-pool-size="10" instance-acquisition-timeout="1" instance-acquisition-timeout-unit="MINUTES"/>

                    <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

                </bean-instance-pools>

            </pools>

      The strict-max-pool tag has two properties:

·         name: Specify the pool of the stateless beans if the value is “slsb-strit-max-pool-size”.

·         max-pool-size specify indeed, the number of max bean instances.

How the application server instantiates the several instances?

It has its own strategy for doing so. That is to say, the bean instances are not created eagerly but they are created by demand, when JBoss considers.

 

No comments:

Post a Comment