cancel
Showing results for 
Search instead for 
Did you mean: 

ejb MDB Pool Settings ignored?

Former Member
0 Kudos

Hi.

I have a series of MDBs, and have tried to increase performance by setting the InitialSize and MaxSize values of the bean in the ejb-j2ee-engine.xml (not version 3!).

However, it doesnt seem to make any difference and messages seem to be getting processed sequentially, as if there was only one instance of the bean.

Here is the layout of my xml.

<ejb-j2ee-engine

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">

<description/>

<enterprise-beans>

<enterprise-bean>

<ejb-name>mySimpleMDB</ejb-name>

<jndi-name>jms/myTestQueue</jndi-name>

<message-props>

<destination-name>jms/myTestQueue</destination-name>

<connection-factory-name>jms/queueConnectionFactory</connection-factory-name>

<property>

<property-name>InitialSize</property-name>

<property-value>1</property-value>

</property>

<property>

<property-name>MaxSize</property-name>

<property-value>1</property-value>

</property>

<property>

<property-name>ResizeStep</property-name>

<property-value>1</property-value>

</property>

</message-props>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

Is this the correct location - i am pretty sure it is by looking at the documentation.

regards,

Andrew

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Is anyone else experiencing this problem?

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

Sorry for the delay, I was on vacation and could not follow up on this case.

Unfortunately, I'm running out of ideas. Would it be possible for you to provide a sample EAR to reproduce this issue?

Regards,

\-- Vladimir

Former Member
0 Kudos

Vladimir,

Unfortunately, the only test i have of this was using our own app.

The scenario was brought about as follows;

1) Turn off the application

2) Stream approx 15K messages to the 'start queue'

3) Start the application

If, with one mdb, you have it logging the time it starts processing and the time it finishes processing, (even to the log file), it should always be sequential.

If I get the chance, ill try and replicate an ear file.....

Andrew

Vlado
Advisor
Advisor
0 Kudos

Then, I'm afraid, the only option left is to open a support ticket. However, I'm pretty sure it will need that kinda input from your side as well, as our tests don't show off such behaviour.

\-- Vladimir

0 Kudos

Hello Andrew.

Did you solve it?

Regards

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

For transacted MDBs on queues you can achieve this by tweaking the "parallel-consumers" property. For more information refer to the last question in this [JMS FAQ|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/604e2b64-e689-2910-64b3-ffd650f83756].

HTH!

-- Vladimir

Former Member
0 Kudos

Hi Vladimir!

We tried this and put the parallel consumers to 10, and set the pool sizes to be a initial of 10, max of 10 and resize of 1.

This didnt seem to make any difference and the messages were still processed sequentially.

Is there anyway to see the number of instances of an mdb at any one time? Or to see the 'mini-queues' that are used with the parallel consumer option?

Regards,

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

How do you tell that the messages are processed sequentially?

A test could be to perform some long-blocking operation in the onMessage() method (several seconds), simulate the load and get a thread dump. This would show off how many MDB instances are currently executing in the onMessage(). If you have configured everything correctly there should be more than one.

HTH!

\-- Vladimir

Former Member
0 Kudos

Vladimir,

We are able to tell because our MDBs log a start time and end time in a database, and each row has a start time which is after the endtime of the row before.

Regards,

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

Is the messages load sufficiently high to expect parallel consumption? The FAQ does say that if you publish only few messages "they potentially could fall into one and the same miniqueue and be delivered sequentially".

Could you produce a thread dump as discussed above, just to make sure and eliminate any doubts?

Please also check that you have enough free application threads to serve message processing.

Regards,

\-- Vladimir

Former Member
0 Kudos

Hi Vladimir,

The message load is high (at approx 16K messages), so I am assuming that breaches the threshold for the queues to allow parallel-consumers to operate.

Can you point me in the direction of any documentation on how to create a thread dump within Netweaver, and how to check the number of free application threads?

Many thanks again!

Regards,

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

For how to get a thread dump please refer to SAP Note 1095473.

You can monitor AS Java threads in the SAP MMC. Go to SAP Systems -> <SID> -> <instance> -> AS Java Threads and check if there are threads named <Free pool thread> in the System, Application and Managed_Application_Thread pools. (You can apply filters under the column names.)

One more thing you could check to find out how many consumers have actually been created, i.e. if the value in the deployment descriptor has been read and applied as intended: Start AS Java Telnet (from the SAP MMC -> AS Java Process Table -> icm -> context menu) and execute:

add jms
jms list consumers

Then check how many consumers are listed for your queue. (In fact, this is the first thing we should have started our analysis with.)

Regards,

\-- Vladimir

Former Member
0 Kudos

Vladimir,

I have checked the consumers, and there is only 1 per queue, not multiple consumers for one queue, as would be expected for parallel consumers.

With regards to the thread pool, i observed the application section fluxuating between 1 and 5 free, with the System having 9 free and Managed application thread having 13 free.

As for the thread dump, I have created it, but do not know how to view it - is there a SAP tool, or can I use a regular java program like jhat from jdk 1.6??

Regards,

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

> I have checked the consumers, and there is only 1 per queue, not multiple consumers for one queue, as would be expected for parallel consumers.

That's strange. Can you post the contents of ejb-jar.xml, ejb-j2ee-engine.xml, and jms-resources.xml? Or if they are too large - just the parts that are relevant to the MDB and its associated queue / connection factory (don't forget the assembly-descriptor part in ejb-jar.xml, if any).

> As for the thread dump, I have created it, but do not know how to view it - is there a SAP tool, or can I use a regular java program like jhat from jdk 1.6??

You can open it with any text editor. (Maybe you think of the heap dump for which you would need a specially crafted tool.)

Cheers,

\-- Vladimir

Former Member
0 Kudos

Hi Vladimir - here are the relevant XML files:

ejb-jar.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>

<display-name>TestApp</display-name>

<message-driven>

<description>Validates</description>

<display-name>Validation</display-name>

<ejb-name>FileValidationMDB</ejb-name>

<ejb-class>com.test.dts.ejb.FileValidationMDBBean</ejb-class>

<transaction-type>Container</transaction-type>

<acknowledge-mode>Auto-acknowledge</acknowledge-mode>

<message-driven-destination>

<destination-type>javax.jms.Queue</destination-type>

</message-driven-destination>

<env-entry>

<description/>

<env-entry-name>ejb/beanRefContext</env-entry-name>

<env-entry-type>java.lang.String</env-entry-type>

<env-entry-value>classpath:beanRefContext.xml</env-entry-value>

</env-entry>

</message-driven>

</enterprise-beans>

<assembly-descriptor>

<container-transaction>

<method>

<ejb-name>FileValidationMDB</ejb-name>

<method-name>onMessage</method-name>

<method-params>

<method-param>javax.jms.Message</method-param>

</method-params>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

</assembly-descriptor>

</ejb-jar>

ejb-j2ee-engine.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<ejb-j2ee-engine

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">

<description/>

<enterprise-beans>

<enterprise-bean>

<ejb-name>FileValidationMDB</ejb-name>

<jndi-name>jms/dts/registeredFiles</jndi-name>

<message-props>

<destination-name>jms/dts/registeredFiles</destination-name>

<connection-factory-name>jms/dts/queueConnectionFactory</connection-factory-name>

<property>

<property-name>parallel-consumers</property-name>

<property-value>10</property-value>

</property>

<property>

<property-name>InitialSize</property-name>

<property-value>10</property-value>

</property>

<property>

<property-name>MaxSize</property-name>

<property-value>10</property-value>

</property>

<property>

<property-name>ResizeStep</property-name>

<property-value>1</property-value>

</property>

</message-props>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

jms-resources.xml

<?xml version="1.0" encoding="UTF-8"?>

<jms-resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jms-resources.xsd">

<connection-factory>

<name>jms/dts/XAConnectionFactory</name>

<sap-local-factory-type>

<type>javax.jms.XAConnectionFactory</type>

<virtual-provider>default</virtual-provider>

</sap-local-factory-type>

</connection-factory>

<connection-factory>

<name>jms/dts/queueConnectionFactory</name>

<sap-local-factory-type>

<type>javax.jms.XAQueueConnectionFactory</type>

<virtual-provider>default</virtual-provider>

</sap-local-factory-type>

</connection-factory>

<connection-factory>

<name>jms/dts/topicConnectionFactory</name>

<sap-local-factory-type>

<type>javax.jms.XATopicConnectionFactory</type>

<virtual-provider>default</virtual-provider>

</sap-local-factory-type>

</connection-factory>

<destination>

<name>jms/dts/registeredFiles</name>

<type>javax.jms.Queue</type>

<sap-local-destination-type>

<virtual-provider>default</virtual-provider>

<!-- Properties for Message delivery -->

<property>

<description>

Message Delivery Attempts Limited - We dont limit...

</description>

<config-property-name>

deliveryAttemptsLimited

</config-property-name>

<config-property-value>false</config-property-value>

</property>

<property>

<description>Delay in Milliseconds</description>

<config-property-name>

deliveryDelayInterval

</config-property-name>

<config-property-value>60000</config-property-value>

</property>

</sap-local-destination-type>

</destination>

</jms-resources>

Hope this sheds some light on the subject...

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

I can't figure out anything wrong with your DD.

If you increase the severity of location com.sap.jms to DEBUG, you should be able to find an entry in the defaultTrace as below:

applicationName=<applicationName>,connectionFactoryName : <connectionFactoryName>, [...] mParallelConsumers : <mParallelConsumers>

Please check what is written out for <mParallelConsumers>.

Regards,

\-- Vladimir

Former Member
0 Kudos

Hi Vladimir.

I checked the trace files and found the following message:

An attempt to stop message delivery will be performed. Activation request was applicationName=......,connectionFactoryName : jms/dts/queueConnectionFactory,mAcknowledgeMode : Auto-acknowledge,maxPoolSize : 50,mClientId : null,mDestinationName : jms/dts/registeredFiles,mDestinationType : javax.jms.Queue,minPoolSize : 0,mMessageSelector : null,mSubscriptionDurability : null,mSubscriptionName : null,mReconnectAttempts : 10,mSleepBetweenAttempts : 1000,mParallelConsumers : 1

Is it worth noting that this is deployed via JSPM - would that make a difference??

Regards,

Andrew

Vlado
Advisor
Advisor
0 Kudos

Hi Andrew,

Please try with "parallelConsumers" instead of "parallel-consumers".

Cheers,

\-- Vladimir

Former Member
0 Kudos

Vladimir,

I have tried changing that to parallelConsumers, but it has not made any difference to the log entry. It still states parallelConsumers of 1.

Regards,

Andrew