Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033129
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminoralways2016-06-03 11:142016-06-17 19:38
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q3
StatusclosedFix in branchFixed in SCM revision5c3ae208fb2c
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033129: unneeded object initialization for DAL insertion

DescriptionThe first time a new DAL object is saved per transaction (typically per request). Some unneeded DAL objects are initialized. This has a performance impact because:

 1. Additional DB queries are executed
 2. Some heap is consumed for those DAL objects. If the request processing is fast, they are quickly made electable for garbage collection, but in any case this makes GC to be invoked more often than needed.
Steps To Reproduce0. Copy the following code somewhere executable (ie. in About.java):

    for (int i = 0; i < 10; i++) {
      AlertRule newAlert = OBProvider.getInstance().get(AlertRule.class);
      newAlert.setName(Long.toString(System.currentTimeMillis()));
      OBDal.getInstance().save(newAlert);
    }


1. set HQL to bebug
2. Execute it and check the log

9169004 [http-8080-3] DEBUG org.hibernate.SQL - select ... from AD_Client adclient0_ where adclient0_.AD_Client_ID=?

9169005 [http-8080-3] DEBUG org.hibernate.SQL - select ... from AD_Language adlanguage0_ where adlanguage0_.AD_Language=?

9169005 [http-8080-3] DEBUG org.hibernate.SQL - select ... from AD_Org organizati0_ where organizati0_.AD_Org_ID=?

9169006 [http-8080-3] DEBUG org.hibernate.SQL - select ... from AD_User aduser0_ where aduser0_.AD_User_ID 
in (?, ?)

9172172 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...
9172173 [http-8080-3] DEBUG org.hibernate.SQL - insert into AD_AlertRule ...


First 4 queries are unnecessary, they are executed to instantiate client, org and user DAL objects.

Proposed SolutionUse Hibernate proxies for these objects so they don't need to be initialized.
TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0033126 closedshuehner Avoid select to ad_role during creation of c_import_entry 

-  Notes
(0086986)
hgbot (developer)
2016-06-03 13:58

Repository: erp/devel/pi
Changeset: 5c3ae208fb2c59fc17b2ced22a80a0c2813ec72f
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jun 03 13:58:10 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/5c3ae208fb2c59fc17b2ced22a80a0c2813ec72f [^]

fixed bug 33129: unneeded object initialization for DAL insertion

  When doing DAL insertions, client, org and user objects were initialized if
  they were not yet in session. This causes unneded DB queries and object allocation
  in memory.

  These objects were used to set mandatory client/org and audit fields.

  This initialization is now prevented by using hibernate proxies instead.

---
M src/org/openbravo/dal/core/OBInterceptor.java
M src/org/openbravo/dal/service/OBDal.java
---
(0086990)
caristu (developer)
2016-06-03 15:21

Code review + testing OK: extra queries to AD_Client, AD_Org and AD_User are not done anymore.

Verified in pi@5c3ae208fb2c
(0087590)
hudsonbot (developer)
2016-06-17 19:38

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/0dc7be081b1c [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2016-06-03 11:14 alostale New Issue
2016-06-03 11:14 alostale Assigned To => platform
2016-06-03 11:14 alostale Modules => Core
2016-06-03 11:14 alostale Triggers an Emergency Pack => No
2016-06-03 11:16 alostale Steps to Reproduce Updated View Revisions
2016-06-03 11:20 alostale Steps to Reproduce Updated View Revisions
2016-06-03 11:20 alostale Proposed Solution updated
2016-06-03 11:22 alostale Tag Attached: Performance
2016-06-03 13:58 hgbot Checkin
2016-06-03 13:58 hgbot Note Added: 0086986
2016-06-03 13:58 hgbot Status new => resolved
2016-06-03 13:58 hgbot Resolution open => fixed
2016-06-03 13:58 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5c3ae208fb2c59fc17b2ced22a80a0c2813ec72f [^]
2016-06-03 14:36 alostale Review Assigned To => caristu
2016-06-03 15:05 caristu Relationship added related to 0033126
2016-06-03 15:18 caristu Assigned To platform => alostale
2016-06-03 15:21 caristu Note Added: 0086990
2016-06-03 15:21 caristu Status resolved => closed
2016-06-03 15:21 caristu Fixed in Version => 3.0PR16Q3
2016-06-17 19:38 hudsonbot Checkin
2016-06-17 19:38 hudsonbot Note Added: 0087590
2016-12-16 14:15 psanjuan Relationship added related to 0032423
2016-12-16 14:15 psanjuan Relationship deleted related to 0032423
2016-12-16 14:15 psanjuan Relationship added blocks 0032423
2016-12-16 14:15 psanjuan Relationship deleted blocks 0032423
2016-12-19 11:08 psanjuan Relationship added related to 0032423
2016-12-19 11:09 psanjuan Relationship deleted related to 0032423


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker