Openbravo Issue Tracking System - Openbravo ERP | |||||||||||||||||||
View Issue Details | |||||||||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||||||||
0038205 | Openbravo ERP | I. Performance | public | 2018-03-22 18:13 | 2018-05-09 19:30 | ||||||||||||||
Reporter | gorkaion | ||||||||||||||||||
Assigned To | collazoandy4 | ||||||||||||||||||
Priority | urgent | Severity | major | Reproducibility | always | ||||||||||||||
Status | closed | Resolution | fixed | ||||||||||||||||
Platform | OS | 5 | OS Version | ||||||||||||||||
Product Version | |||||||||||||||||||
Target Version | Fixed in Version | 3.0PR18Q3 | |||||||||||||||||
Merge Request Status | |||||||||||||||||||
Review Assigned To | dmiguelez | ||||||||||||||||||
OBNetwork customer | |||||||||||||||||||
Web browser | |||||||||||||||||||
Modules | Core | ||||||||||||||||||
Support ticket | |||||||||||||||||||
Regression level | |||||||||||||||||||
Regression date | |||||||||||||||||||
Regression introduced in release | |||||||||||||||||||
Regression introduced by commit | |||||||||||||||||||
Triggers an Emergency Pack | No | ||||||||||||||||||
Summary | 0038205: Cost Adjustment Process very slow | ||||||||||||||||||
Description | A Cost Adjustment on an environment with 16k transactions and adjusting 11.5k takes almost 10h to complete. After a review in YourKit there are 3 areas of improvement. 1. Method that inserts m_transaction_cost records. 2. Logic to calculate new LineNo of Cost Adjustment Line. 3. Inserts in Cost Adjustment Line. (already reported to platform in a separate issue 0038197 ) | ||||||||||||||||||
Steps To Reproduce | On an environment with around 16k transactions using manufacturing. Execute a Cost Adjustment on one of the oldest transactions of a raw material. This adjustment will also impact all items produced with that raw material resulting in a cost adjustment including many m_transactions, and much more adjustment lines. | ||||||||||||||||||
Proposed Solution | Attached a patch extracted from a customer test instance with a tentative fix for issues 1st and 2nd, and other changes to improve performance. This patch does changes in following core files reducing the time to 2.5h: AverageCostAdjustment: - Logger using wrong class. - Remove not needed save() from updated objects. CostAdjustmentProcess: - Remove not needed save() from updated objects. - generateTransactionCosts(): -- Do the flush() only once at the end. -- Evict the trx object on each iteration as it is not modified. Or instead of loading the full trx change to a query retrieving only the required properties. -- Even better change the method to use a unique insert statement. CostAdjustementUtils: - getNewLineNo() method consumes too much time when many lines are added on a single adjustment. -- Change order and get first by a get max(line) -> when there is no index on the order column it performs better. -- Add a new insertCostAdjustmentLine() with a lineNo parameter so it is not required to call the getNewLineNo() method. CostingAlgorithmAdjustmentImp: - Add new field nextLineNo to store last LineNo used to use new API in CostAdjustmentUtils and avoid the query to get the max lineno. With the provided patch the flush() still takes almost 1/3 of the total time. Other changes that could be considered are: in any class involved: - Review if there are more flush() and save() that can be removed. - Review if it is possible to do a query to get a single property instead of the full BaseOBObject to reduce memory usage and fasten the flushes when the BaseOBObject is not expected to be updated. AverageCostAdjustment: - 2 flushes required when updating m_costing to avoid the trigger that disables the ability to modify a permanent costing. -- Consider a massive update of the m_costing to set the flag to false and another one at the end to set it back to true to avoid 2 flushes on each m_costing update. Or disable the trigger when the CostAdjustmentProcess is running. | ||||||||||||||||||
Additional Information | |||||||||||||||||||
Tags | No tags attached. | ||||||||||||||||||
Relationships |
| ||||||||||||||||||
Attached Files | cost-adjustment-performance.diff (8,528) 2018-03-22 18:13 https://issues.openbravo.com/file_download.php?file_id=11669&type=bug | ||||||||||||||||||
Issue History | |||||||||||||||||||
Date Modified | Username | Field | Change | ||||||||||||||||
2018-03-22 18:13 | gorkaion | New Issue | |||||||||||||||||
2018-03-22 18:13 | gorkaion | Assigned To | => Triage Finance | ||||||||||||||||
2018-03-22 18:13 | gorkaion | File Added: cost-adjustment-performance.diff | |||||||||||||||||
2018-03-22 18:13 | gorkaion | Modules | => Core | ||||||||||||||||
2018-03-22 18:13 | gorkaion | Resolution time | => 1523484000 | ||||||||||||||||
2018-03-22 18:13 | gorkaion | Triggers an Emergency Pack | => No | ||||||||||||||||
2018-03-22 18:14 | ngarcia | Issue Monitored: ngarcia | |||||||||||||||||
2018-03-22 18:14 | gorkaion | Relationship added | related to 0038197 | ||||||||||||||||
2018-03-22 18:29 | gorkaion | Issue cloned | 0038206 | ||||||||||||||||
2018-03-22 18:31 | gorkaion | Relationship added | related to 0038206 | ||||||||||||||||
2018-04-09 19:36 | aferraz | Assigned To | Triage Finance => collazoandy4 | ||||||||||||||||
2018-04-10 23:19 | collazoandy4 | Status | new => scheduled | ||||||||||||||||
2018-04-17 08:48 | dmiguelez | Status | scheduled => feedback | ||||||||||||||||
2018-04-20 13:09 | gorkaion | Status | feedback => scheduled | ||||||||||||||||
2018-05-02 18:13 | collazoandy4 | Note Added: 0104211 | |||||||||||||||||
2018-05-03 17:42 | dmiguelez | Note Added: 0104240 | |||||||||||||||||
2018-05-04 09:27 | hgbot | Checkin | |||||||||||||||||
2018-05-04 09:27 | hgbot | Note Added: 0104271 | |||||||||||||||||
2018-05-04 09:27 | hgbot | Status | scheduled => resolved | ||||||||||||||||
2018-05-04 09:27 | hgbot | Resolution | open => fixed | ||||||||||||||||
2018-05-04 09:27 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/ce7759e1ac82ca358fb57295a3c8db53830b0664 [^] | ||||||||||||||||
2018-05-04 09:27 | hgbot | Checkin | |||||||||||||||||
2018-05-04 09:27 | hgbot | Note Added: 0104272 | |||||||||||||||||
2018-05-04 09:27 | hgbot | Checkin | |||||||||||||||||
2018-05-04 09:27 | hgbot | Note Added: 0104274 | |||||||||||||||||
2018-05-04 09:27 | hgbot | Checkin | |||||||||||||||||
2018-05-04 09:27 | hgbot | Note Added: 0104275 | |||||||||||||||||
2018-05-04 09:28 | dmiguelez | Review Assigned To | => dmiguelez | ||||||||||||||||
2018-05-04 09:28 | dmiguelez | Note Added: 0104276 | |||||||||||||||||
2018-05-04 09:28 | dmiguelez | Status | resolved => closed | ||||||||||||||||
2018-05-04 09:28 | dmiguelez | Fixed in Version | => 3.0PR18Q3 | ||||||||||||||||
2018-05-09 19:29 | hudsonbot | Checkin | |||||||||||||||||
2018-05-09 19:29 | hudsonbot | Note Added: 0104428 | |||||||||||||||||
2018-05-09 19:29 | hudsonbot | Checkin | |||||||||||||||||
2018-05-09 19:29 | hudsonbot | Note Added: 0104429 | |||||||||||||||||
2018-05-09 19:29 | hudsonbot | Checkin | |||||||||||||||||
2018-05-09 19:29 | hudsonbot | Note Added: 0104431 | |||||||||||||||||
2018-05-09 19:30 | hudsonbot | Checkin | |||||||||||||||||
2018-05-09 19:30 | hudsonbot | Note Added: 0104432 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|