Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029487Openbravo ERP04. Warehouse managementpublic2015-03-03 18:302015-04-01 10:49
0029487: Performance Problems on Costing Background process
Running Costing Background process on an environment with a lot of transactions to be calculated (200.000), it consumes a lot of memory and cpu, and it does not finish.
We have an environment with a lot of transactions in which the problem is reproduced.

Launch Costing Background process.
blocks defect 0029118 closed umartirena Performance Problems on Costing Background process 
Issue History
2015-04-01 09:43SandrahuguetTypedefect => backport
2015-04-01 09:43SandrahuguetTarget Version => 3.0PR15Q2
2015-04-01 09:44SandrahuguetTag Attached: Approved
2015-04-01 10:48hgbotCheckin
2015-04-01 10:48hgbotNote Added: 0076289
2015-04-01 10:48hgbotStatusscheduled => resolved
2015-04-01 10:48hgbotResolutionopen => fixed
2015-04-01 10:48hgbotFixed in SCM revision => [^]
2015-04-01 10:49SandrahuguetReview Assigned To => Sandrahuguet
2015-04-01 10:49SandrahuguetNote Added: 0076291
2015-04-01 10:49SandrahuguetStatusresolved => closed
2015-04-01 10:49SandrahuguetFixed in Version => 3.0PR15Q2

2015-04-01 10:48   
Repository: erp/backports/3.0PR15Q2
Changeset: d80a1e60b2e0bd92285d10e026a81aa9e093a317
Author: Unai Martirena <unai.martirena <at>>
Date: Wed Mar 04 16:09:33 2015 +0100
URL: [^]

Fixes bug 29487: Performance improved in Costing Background process.

There are two methods in Costing Background process in which an ScrollableResult is built and iterated. 'setCalculatedTransactionsAsProcessed' and 'setCalculatedTransactionsAsProcessed'. This loops where causing Out of memory issues because they were not flushing and clearing session every little amount of iterations. Apart from this, the two ScrollableResults were leaving opened, which may cause lot of issues especially in Oracle.

Finally, these methods have been implemented in another way. Directly updating all the records on a single update in hql. In this way the performance is improved even adding flush and clear on the previously loops.

M src/org/openbravo/costing/
2015-04-01 10:49   
Code review + testing OK