1 Reply Latest reply on Oct 27, 2014 10:28 AM by Carolina Contiu

    Jboss 7.1.1 AS : Poor performance when opening db connection using xa-datasource

    Carolina Contiu Newbie

      I'm migrating an application from Jboss 6.1.0 to 7.1.1 AS. Once migration completed, load tests revealed  the application was performing slower with jboss 7 than used to perform with 6.

      Investigation lead to the conclusion that the process of obtaining a jdbc connection takes  longer than it  used to take when using jboss 6.1.0.

      I'm using a xa-datasource connecting to a Oracle 11g database.

      The test I'm performing: 400 concurrent threads executing simultaneously  an update( or select) operation  (using a namedquery, entity manager  in a transactional method of a stateles bean).

      Looking to amount of time it takes each thread to complete, it gives me the impression that the db operations where performed   serially and not concurrently.

      The test ends after several minutes (with jboss 6 used to take several seconds).

      I performed a thread dump during the test, most of my threads are hanging as the one below:

       

      "Thread-7157" daemon prio=10 tid=0x00007ff090487000 nid=0x7efe waiting for monitor entry [0x00007ff01c481000]

          java.lang.Thread.State: BLOCKED (on object monitor)

           at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnectionFactory.getConnectionProperties(BaseWrapperManagedConnectionFactory.java:951)

           - waiting to lock <0x00000000dcd557d0> (a org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$MyXaMCF)

           at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkIdentity(BaseWrapperManagedConnection.java:829)

           at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.getConnection(BaseWrapperManagedConnection.java:458)

           at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:473)

           at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)

           at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)

           at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:301)

           at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214)

           at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157)

           at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56)

           at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:159)

           at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183)

           at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:157)

           at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1881)

           at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1858)

           at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838)

           at org.hibernate.loader.Loader.doQuery(Loader.java:906)

           at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348)

           at org.hibernate.loader.Loader.doList(Loader.java:2550)

           at org.hibernate.loader.Loader.doList(Loader.java:2536)

           at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366)

           at org.hibernate.loader.Loader.list(Loader.java:2361)

           at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495)

           at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357)

           at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:198)

           at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1194)

           at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)

           at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:287)

       

       

       

       

      My datasource configuration:

       

        <xa-datasource jndi-name="java:jboss/datasources/ChromeSyncMLDS" pool-name="MySyncMLDS" enabled="true" use-java-context="true">

                           <xa-datasource-property name="URL">jdbc:oracle:thin:@192.168.4.85:1521:orcl</xa-datasource-property>

                            <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

                           <driver>oracle</driver>

                           <xa-pool>

                                    <min-pool-size>2</min-pool-size>

                                     <max-pool-size>400</max-pool-size>

                                    <prefill>true</prefill>

                                     <is-same-rm-override>false</is-same-rm-override>

                           </xa-pool>

                           <security>

                                <security-domain>MyConnectorDS-oracle-encrypted-password</security-domain>

                           </security>

                           <recovery no-recovery="true"/>

                           <validation>

                                     <validate-on-match>false</validate-on-match>

                                     <background-validation>true</background-validation>

                                     <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.OracleExceptionSorter"/>

                           </validation>

                           <timeout>

                                     <blocking-timeout-millis>5000</blocking-timeout-millis>

                                     <idle-timeout-minutes>2</idle-timeout-minutes>

                           </timeout>

                           <statement>

                                     <track-statements>true</track-statements>

                                     <prepared-statement-cache-size>1000</prepared-statement-cache-size>

                           </statement>

                       </xa-datasource>

       

       

      My properties from persistence.xml

        <properties>

                   <property name="hibernate.dialect" value="org.hibernate.dialect.CustomOracleDialect"></property>

                   <property name="hibernate.connection.release_mode" value="auto"></property>

                   <property name="hibernate.transaction.auto_close_session" value="true"></property>

                   <property name="hibernate.show_sql" value="false"></property>

      </properties>

       

      Is there anything I missed when configuring my datastore ? Or are there any limitations (e.g thread pool sizes etc) introduced in jboss 7 that I should  pay attention to?

      I would appreciate your advice.

      Thank you.