How to limit the MDB pool size on Glassfish v3

my Message Driven Bean performs very intensive operations, so I would like to limit its pool size, or my server would be overloaded. I tried this (code), but it does not work, its pool is still 32 (empirically verified, from time to time I restart the server so that there are no empty instances).

@MessageDriven( mappedName = "jms/TestTopic", activationConfig = { @ActivationConfigProperty( propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge" ), @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Topic" ), @ActivationConfigProperty( propertyName = "subscriptionDurability", propertyValue = "Durable" ), @ActivationConfigProperty( propertyName = "clientId", propertyValue = "Reader" ), @ActivationConfigProperty( propertyName = "subscriptionName", propertyValue = "Reader" ), @ActivationConfigProperty( propertyName = "endpointPoolMaxSize", propertyValue = "1" ), @ActivationConfigProperty( propertyName = "endpointPoolResizeCount", propertyValue = "1" ), @ActivationConfigProperty( propertyName = "endpointPoolSteadySize", propertyValue = "0" ) } ) public class Reader implements MessageListener { 

I am using EJB 3 on Glassfish v3 on JDK 6. The application uses the EE 6 standard.

Can you help me how to limit the pool, please? Thanks for any help.

+4
source share
2 answers

I would recommend creating sun-ejb-jar.xml and putting the pool configuration there. See bean -pool at http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_1-0.dtd for raw details. See bean -pool at http://download.oracle.com/docs/cd/E19798-01/821-1750/6nmnbjlfi/index.html for details beautifully polished.

+3
source

I followed the links posted by @vkraemer, and below is my snippet of code. It seems that steady-pool-size and resize-quantity also needed because their default values ​​are incompatible with the small pool size.

 <glassfish-ejb-jar> <enterprise-beans> <ejb> <ejb-name>SimpleClassName</ejb-name> <bean-pool> <steady-pool-size>1</steady-pool-size> <resize-quantity>1</resize-quantity> <max-pool-size>6</max-pool-size> </bean-pool> </ejb> </enterprise-beans> </glassfish-ejb-jar> 

But remember :

Setting a small max-pool-size can lead to excessive destruction of the object (and as a result of excessive creation of the object), since instances are destroyed from the pool if the current pool size exceeds max-pool-size .

... from GlassFish performance-tuning-guide

0
source

Source: https://habr.com/ru/post/1340385/


All Articles