1


When load increases then stateless session beans count increases but later stateless beans are not removed from slsb-strict-max-pool when all are idle. Is there any setting to remove idle stateless bean ? Same issue in wildly 21 also. See below, pool-remove-count is always 0.

standalone.xml

..........
        <subsystem xmlns="urn:jboss:domain:ejb3:5.0">
            <session-bean>
                <stateless>
                    <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
                </stateless>
                <stateful default-access-timeout="60000" cache-ref="distributable" passivation-disabled-cache-ref="simple"/>
                <singleton default-access-timeout="5000"/>
            </session-bean>
            <mdb>
                <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
            </mdb>
            <pools>
                <bean-instance-pools>
                    <strict-max-pool name="slsb-strict-max-pool" max-pool-size="150" instance-acquisition-timeout="2" instance-acquisition-timeout-unit="MINUTES"/>
                    <strict-max-pool name="mdb-strict-max-pool" max-pool-size="100" instance-acquisition-timeout="2" instance-acquisition-timeout-unit="MINUTES"/>
                </bean-instance-pools>
            </pools>
...................
sudo /opt/wildfly-13.0.0.Final/bin/jboss-cli.sh -c command="/deployment=Test-EAR.ear/subdeployment=Test.jar/subsystem=ejb3/stateless-session-bean=TestBean:read-resource(include-runtime=true)"
{
    "outcome" => "success",
    "result" => {
        "component-class-name" => "TestBean",
        "declared-roles" => [],
        "execution-time" => 237948636L,
        "invocations" => 67748L,
        "methods" => {"performRequest" => {
            "execution-time" => 237948636L,
            "invocations" => 67748L,
            "wait-time" => 4403L
        }},
        "peak-concurrent-invocations" => 150L,
        "pool-available-count" => 150,
        "pool-create-count" => 150,
        "pool-current-size" => 150,
        "pool-max-size" => 150,
        "pool-name" => "slsb-strict-max-pool",
        "pool-remove-count" => 0,
        "run-as-role" => undefined,
        "security-domain" => "other",
        "timers" => [],
        "wait-time" => 4403L,
        "service" => undefined
    }
}

Please help. Thanks.

kunal
  • 323
  • 2
  • 9
  • Why are you trying to remove them? Typically they have quite low resource footprint. If you are struggling for memory, they are likely to be more effective ways to resolve – Will Tatam Jan 15 '21 at 09:25
  • I think the pool-remove-count might actually reflect the count of "defective" beans. Try throwing an uncaught exception and see if it increases – Will Tatam Jan 15 '21 at 09:29
  • @Will T Thanks for reply. Actually i have Activemq connection variable on bean & on bean destroy I close this. So I wanted to remove them when bean are idle for long time. Is this wrong way to use bean? I will try your suggesion. – kunal Jan 16 '21 at 10:41
  • Are you using the JMS 2.0 API? Typically an EJB is only producer or consumer only for lifetime of a single invocation. I'm a little concerned from your wording that you might be to using the RemoteConnectionFacory or similar client api inside the container – Will Tatam Jan 16 '21 at 11:52
  • Yes..Im using JMS 2.0 API. On bean, @PostConstruct method I created activemq connection( like connection, session, producer, consumer) using ConnectionFactory (resource-adapter setting in wildly where I have pools of connections as well as idle timeout). Anything wrong using such way ? – kunal Jan 18 '21 at 08:09
  • @Will T If you are struggling for memory, they are likely to be more effective ways to resolve --> Yes..Im getting memory issue & I suspect because of some peak a lot beans created with a lot activemq connection & since bean remains lifetime so occupying more memory. I exactly don't remember but in Glassfish/WebLogic we have option to destroy idle stateless beans but no such provision in wildly ?? – kunal Jan 18 '21 at 08:21
  • 1
    As you are using v2.0 then your old field of the bean should be the JMSContext, see http://www.mastertheboss.com/jboss-server/jboss-jms/jms-20-tutorial-on-wildfly-as – Will Tatam Jan 18 '21 at 09:09
  • Thanks for reply. So here V2.0, no need to explicitly close activemq connection, right ?. About stateless bean, it exist for lifetime in wildly ? No option to destroy idle beans ? – kunal Jan 18 '21 at 10:10
  • Correct, the connection lifecycle is managed for you. – Will Tatam Jan 18 '21 at 11:52
  • Did you try throwing an exception to see if that counter increments? I'm not aware of an option to kill off idle stateless bean instances – Will Tatam Jan 18 '21 at 11:55
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/227487/discussion-between-kunal-and-will-t). – kunal Jan 18 '21 at 12:01

0 Answers0