Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029903Openbravo ERPA. Platformpublic2015-05-16 12:402015-05-26 10:12
mtaal 
AugustoMauch 
normalminorhave not tried
closedfixed 
5
 
3.0PR15Q33.0PR15Q3 
alostale
Core
No
0029903: Performance improvement in EntityAccessChecker.initialize
Hi,
For the import entry process which imports transactions from WebPOS we need to create OBContexts for each entry which gets imported. There is some caching of OBContexts but still there is a fair change that in large organisations each entry will be created for a different user.

Of the time spend on orderloading: 220 millis around 79 millis are spend on the EntityAccessChecker.initialize.

I found a way to bring this down to 10 millis by changing the query slightly. See the attached diff
See attached timings before and after the change.

Check the lines with Pre-1 and Pre-2, the difference between the two is the time spend on EntityAccessChecker.initialize.

Performance
txt Perf-Before-Improvement.txt (3,034) 2015-05-16 12:40
https://issues.openbravo.com/file_download.php?file_id=8088&type=bug
txt Perf-After-Improvement.txt (6,131) 2015-05-16 12:40
https://issues.openbravo.com/file_download.php?file_id=8089&type=bug
diff 29903.diff (2,511) 2015-05-16 12:41
https://issues.openbravo.com/file_download.php?file_id=8090&type=bug
Issue History
2015-05-16 12:40mtaalNew Issue
2015-05-16 12:40mtaalAssigned To => AugustoMauch
2015-05-16 12:40mtaalFile Added: Perf-Before-Improvement.txt
2015-05-16 12:40mtaalModules => Core
2015-05-16 12:40mtaalTriggers an Emergency Pack => No
2015-05-16 12:40mtaalFile Added: Perf-After-Improvement.txt
2015-05-16 12:41mtaalFile Added: 29903.diff
2015-05-16 12:43mtaalNote Added: 0077514
2015-05-22 16:11mtaalReview Assigned To => alostale
2015-05-22 16:13hgbotCheckin
2015-05-22 16:13hgbotNote Added: 0077668
2015-05-22 16:13hgbotStatusnew => resolved
2015-05-22 16:13hgbotResolutionopen => fixed
2015-05-22 16:13hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9c8ffa316dabe2f0094ce8ea7330027be4985847 [^]
2015-05-23 13:56shuehnerNote Added: 0077672
2015-05-25 18:01hudsonbotCheckin
2015-05-25 18:01hudsonbotNote Added: 0077721
2015-05-26 10:12alostaleTag Attached: Performance
2015-05-26 10:12alostaleNote Added: 0077743
2015-05-26 10:12alostaleStatusresolved => closed
2015-05-26 10:12alostaleFixed in Version => 3.0PR15Q3

Notes
(0077514)
mtaal   
2015-05-16 12:43   
Here is a link to the code which does OBContext caching and initializing:
https://code.openbravo.com/erp/devel/pi/file/86cf45227364/src/org/openbravo/service/importprocess/ImportEntryProcessor.java#l402 [^]

As an extra remark, we need to support importing 1000+ orders/tickets per minute, which means so saving 70 millis makes a lot of difference.
(0077668)
hgbot   
2015-05-22 16:13   
Repository: erp/devel/pi
Changeset: 9c8ffa316dabe2f0094ce8ea7330027be4985847
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri May 22 16:12:45 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9c8ffa316dabe2f0094ce8ea7330027be4985847 [^]

Fixes issue 29903: Performance improvement in EntityAccessChecker.initialize

---
M src/org/openbravo/dal/security/EntityAccessChecker.java
---
(0077672)
shuehner   
2015-05-23 13:56   
Hi guys,
that change i think is even more useful then you link.

Just think of any web-service calls being done stateless (as they should).
I think any of those needs to go via that indirectly also every time.
(0077721)
hudsonbot   
2015-05-25 18:01   
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/8cc85f698754 [^]
Maturity status: Test
(0077743)
alostale   
2015-05-26 10:12   
code reviewed + tested