-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Puzzling cpu reduction with release_mode=after_transaction
PostPosted: Mon Jul 19, 2010 5:36 am 
Newbie

Joined: Mon Jul 19, 2010 5:19 am
Posts: 1
Hi,

At my current client we have an application which turns out to use only 30% of its original CPU usage just by changing one hibernate setting. The application does only selects, no updates. We don't understand this behavior.

Our config is detailed below.

Does anyone have a clue why we use 70% less cpu with this small change? Has anyone ever seen something similar?

Any insight is welcome,

Richard



The hibernate properties are as follows. The change is for hibernate.connection.release_mode from auto to after_transaction

We use a org.springframework.orm.hibernate3.LocalSessionFactoryBean as sessionFactory.
With the following configuration:
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                <property name="dataSource" ref="dataSource"/>
                <property name="mappingResources">
                        ...
                </property>
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
                                <prop key="hibernate.show_sql">false</prop>
                                <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
                                <prop key="hibernate.cache.use_query_cache">false</prop>
                                <prop key="hibernate.cache.use_second_level_cache">false</prop>
                                <prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
                                <prop key="hibernate.jdbc.batch_size">20</prop>
                                <!-- <prop key="hibernate.connection.release_mode">auto</prop> -->
                                <prop key="hibernate.connection.release_mode">after_transaction</prop>
                        </props>
                </property>
        </bean>


The defined dataSource is a Websphere 6 jdbc connection pool and it is Non-XA. It is connected to an Oracle 9 RAC cluster.

The transaction manager which is defined is:

Code:
       <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                <property name="sessionFactory" ref="sessionFactory" />
        </bean>



There is no transactionFactory defined, so I guess the Hibernate default JTATransactionFactory is used since we are inside Websphere and have JTA support. If so, the default connection release mode for auto is AFTER_STATEMENT. But this is purely derived from documentation:
http://community.jboss.org/wiki/Sessionsandtransactions
http://www.redhat.com/docs/en-US/JBoss_ ... Modes.html

The web.xml configuration we use pretty standard spring stuff:
Code:
        <listener>
                <listener-class>
                        org.springframework.web.context.ContextLoaderListener
                </listener-class>
        </listener>
        <listener>
                <listener-class>
                        org.springframework.web.util.Log4jConfigListener
                </listener-class>
        </listener>
        <!-- Configuring Servlet mapping for Spring MVC's servlet actions -->

        <servlet>
                <servlet-name>page</servlet-name>
                <servlet-class>
                        org.springframework.web.servlet.DispatcherServlet
                </servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet>
                <servlet-name>update</servlet-name>
                <servlet-class>
                        org.springframework.web.servlet.DispatcherServlet
                </servlet-class>
                <load-on-startup>2</load-on-startup>
        </servlet>

        <listener>
                <listener-class>
                        org.springframework.web.context.ContextLoaderListener
                </listener-class>
        </listener>
        <listener>
                <listener-class>
                        org.springframework.web.util.Log4jConfigListener
                </listener-class>
        </listener>
        <!-- Configuring Servlet mapping for Spring MVC's servlet actions -->

        <servlet>
                <servlet-name>page</servlet-name>
                <servlet-class>
                        org.springframework.web.servlet.DispatcherServlet
                </servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet>
                <servlet-name>update</servlet-name>
                <servlet-class>
                        org.springframework.web.servlet.DispatcherServlet
                </servlet-class>
                <load-on-startup>2</load-on-startup>
        </servlet>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.