Bug 835578 - Open an "Identity Transaction" only when it is necessary
Summary: Open an "Identity Transaction" only when it is necessary
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise Portal Platform 5
Classification: JBoss
Component: PicketLink, Portal
Version: 5.2.1.ER02
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 5.2.2.ER01
Assignee: mposolda
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-26 14:16 UTC by mposolda
Modified: 2013-04-30 23:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Hibernate transactions had to be started for each HTTP request from an anonymous or authenticated user, which in turn required a new database connection from the connection pool (an expensive operation if it is not required for the request). The fix enables a new option, "lazyStartOfHibernateTransaction", which is set in gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml. </para> <programlisting> &lt;option&gt; &lt;name&gt;lazyStartOfHibernateTransaction&lt;/name&gt; &lt;value&gt;false&lt;/value&gt; &lt;/option&gt; </programlisting> <para>If the value is set to true, the Hibernate transaction is started only when required, and not for every request. The default value is false for backwards-compatibility.
Clone Of:
Environment:
Last Closed:
Type: Enhancement
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker GTNPORTAL-2463 0 Major Resolved Open an "Identity Transaction" only when it is necessary 2018-06-15 08:00:54 UTC
Red Hat Issue Tracker PLIDM-32 0 Major Resolved Support non-JTA client-managed TX mode with lazy tx.begin() 2018-06-15 08:00:54 UTC

Description mposolda 2012-06-26 14:16:12 UTC
The component PicketLinkIDMOrganizationServiceImpl has been defined as a ComponentRequestLifecycle to be able to scope an "identity transaction" to the life time of the request. However depending on the page we try to access, it could be useless to open a tx in case the organization service is not even accessed which can have a dramatic impact on performances for nothing especially when we use hibernate because when we open a tx with hibernate, it does a JDBC call to switch to non auto commit mode.

Comment 1 mposolda 2012-06-26 14:34:05 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
CAUSE: Currently hibernate transaction needs to be started for every HTTP request of anonymous or logged user to EPP. This always needs obtain new DB connection from connection pool, which is quite expensive operation.

FIX: There is fix available in underlying component Picketlink IDM, which added possibility to start Hibernate transaction lazily only for case when it's really needed. It's adding new option "lazyStartOfHibernateTransaction" into Picketlink IDM configuration file. Value true means that Hibernate transaction will be started lazily only when needed. Value false is starting transaction non-lazily during each request (current behaviour)

RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:
          <option>
            <name>lazyStartOfHibernateTransaction</name>
            <value>false</value>
          </option>

We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).

But for customers, who have problem with performance and DB connection is critical for them, it would be good to switch this option to "true".

Comment 2 Michal Vanco 2012-07-17 12:04:13 UTC
Verified with few performance tests with updated lazyStartOfHibernateTransaction (set to true), minimum number of idm connections are present during the tests.

Comment 3 Jared MORGAN 2012-08-20 01:44:41 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -2,12 +2,12 @@
 
 FIX: There is fix available in underlying component Picketlink IDM, which added possibility to start Hibernate transaction lazily only for case when it's really needed. It's adding new option "lazyStartOfHibernateTransaction" into Picketlink IDM configuration file. Value true means that Hibernate transaction will be started lazily only when needed. Value false is starting transaction non-lazily during each request (current behaviour)
 
-RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:
-          <option>
+RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:</para>
+          <programlisting>[CDATA[<option>
             <name>lazyStartOfHibernateTransaction</name>
             <value>false</value>
-          </option>
+          </option>]]</programlisting
 
-We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).
+<para>We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).
 
 But for customers, who have problem with performance and DB connection is critical for them, it would be good to switch this option to "true".

Comment 4 Jared MORGAN 2012-08-20 01:51:08 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -3,10 +3,10 @@
 FIX: There is fix available in underlying component Picketlink IDM, which added possibility to start Hibernate transaction lazily only for case when it's really needed. It's adding new option "lazyStartOfHibernateTransaction" into Picketlink IDM configuration file. Value true means that Hibernate transaction will be started lazily only when needed. Value false is starting transaction non-lazily during each request (current behaviour)
 
 RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:</para>
-          <programlisting>[CDATA[<option>
+          <programlisting>&[CDATA[<option>
             <name>lazyStartOfHibernateTransaction</name>
             <value>false</value>
-          </option>]]</programlisting
+          </option>]];</programlisting
 
 <para>We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).

Comment 5 Jared MORGAN 2012-08-20 02:04:16 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -3,10 +3,10 @@
 FIX: There is fix available in underlying component Picketlink IDM, which added possibility to start Hibernate transaction lazily only for case when it's really needed. It's adding new option "lazyStartOfHibernateTransaction" into Picketlink IDM configuration file. Value true means that Hibernate transaction will be started lazily only when needed. Value false is starting transaction non-lazily during each request (current behaviour)
 
 RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:</para>
-          <programlisting>&[CDATA[<option>
+          <programlisting><![CDATA[<option>
             <name>lazyStartOfHibernateTransaction</name>
             <value>false</value>
-          </option>]];</programlisting
+          </option>]]></programlisting
 
 <para>We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).

Comment 6 Jared MORGAN 2012-08-20 04:17:51 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -3,10 +3,10 @@
 FIX: There is fix available in underlying component Picketlink IDM, which added possibility to start Hibernate transaction lazily only for case when it's really needed. It's adding new option "lazyStartOfHibernateTransaction" into Picketlink IDM configuration file. Value true means that Hibernate transaction will be started lazily only when needed. Value false is starting transaction non-lazily during each request (current behaviour)
 
 RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:</para>
-          <programlisting><![CDATA[<option>
+          <programlisting><option>
             <name>lazyStartOfHibernateTransaction</name>
             <value>false</value>
-          </option>]]></programlisting
+          </option></programlisting>
 
 <para>We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).

Comment 7 Jared MORGAN 2012-08-21 04:46:18 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,13 +1,9 @@
-CAUSE: Currently hibernate transaction needs to be started for every HTTP request of anonymous or logged user to EPP. This always needs obtain new DB connection from connection pool, which is quite expensive operation.
+Hibernate transactions had to be started for each HTTP request from an anonymous or authenticated user, which in turn required a new database connection from the connection pool (an expensive operation if it is not required for the request). The fix enables a new option, "lazyStartOfHibernateTransaction", which is set in gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml. 
-
+</para>
-FIX: There is fix available in underlying component Picketlink IDM, which added possibility to start Hibernate transaction lazily only for case when it's really needed. It's adding new option "lazyStartOfHibernateTransaction" into Picketlink IDM configuration file. Value true means that Hibernate transaction will be started lazily only when needed. Value false is starting transaction non-lazily during each request (current behaviour)
+<programlisting>
-
+  <option>
-RESULT: In configuration file gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml is new option added:</para>
+    <name>lazyStartOfHibernateTransaction</name>
-          <programlisting><option>
+    <value>false</value>
-            <name>lazyStartOfHibernateTransaction</name>
+  </option>
-            <value>false</value>
+</programlisting>
-          </option></programlisting>
+<para>If the value is set to true, the Hibernate transaction is started only when required, and not for every request. The default value is false for backwards-compatibility.-
-<para>We can see that default value is false, so behaviour is same like before (because of backward compatibility and avoiding of risk).
-
-But for customers, who have problem with performance and DB connection is critical for them, it would be good to switch this option to "true".

Comment 8 Jared MORGAN 2012-08-21 06:22:04 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,9 +1,9 @@
 Hibernate transactions had to be started for each HTTP request from an anonymous or authenticated user, which in turn required a new database connection from the connection pool (an expensive operation if it is not required for the request). The fix enables a new option, "lazyStartOfHibernateTransaction", which is set in gatein.ear/02portal.war/WEB-INF/conf/organization/picketlink-idm/picketlink-idm-config.xml. 
 </para>
 <programlisting>
-  <option>
-    <name>lazyStartOfHibernateTransaction</name>
-    <value>false</value>
-  </option>
+&lt;option&gt;
+    &lt;name&gt;lazyStartOfHibernateTransaction&lt;/name&gt;
+    &lt;value&gt;false&lt;/value&gt;
+  &lt;/option&gt;
 </programlisting>
 <para>If the value is set to true, the Hibernate transaction is started only when required, and not for every request. The default value is false for backwards-compatibility.


Note You need to log in before you can comment on or make changes to this bug.