Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0025051Openbravo ERPA. Platformpublic2013-10-30 18:502013-11-01 01:07
shuehner 
shuehner 
normalminorhave not tried
closedfixed 
5
 
3.0MP293.0MP29 
alostale
Core
No
0025051: AlertBackgroundProcess is very slow when having to reprocess many alerts already present in ad_alert
The alert background process does first check for alerts which are outcome of a alertrule (i.e. 15k). Then in a loop for every of those it checks if they have been already inserted into ad_alert and only if not it started processing them (insert + maybe mail).

When a alertrule results in a high number of records i.e. 15k then this fires 15k small queries to check for ad_alert.

Pushing that check directly into the initial query using a (not exists) removes the need for so many small extra queries and also avoids to load the 15k alerts at all into memory.
Take a alertrule and make it create a high number of alerts (i.e. 15k). Example is create 15k ad_process_run entries in status 'ERR'.
Check process monitor runtime for the alertbackground process and see it takes very long.
Debugging timing shows not the initial query to take so long but instead the small utility queries.
Push down the check against ad_alert into the initial query.
Performance
Issue History
2013-10-30 18:50shuehnerNew Issue
2013-10-30 18:50shuehnerAssigned To => shuehner
2013-10-30 18:50shuehnerModules => Core
2013-10-30 18:50shuehnerTriggers an Emergency Pack => No
2013-10-30 19:00shuehnerReview Assigned To => alostale
2013-10-30 23:54hgbotCheckin
2013-10-30 23:54hgbotNote Added: 0061990
2013-10-30 23:54hgbotStatusnew => resolved
2013-10-30 23:54hgbotResolutionopen => fixed
2013-10-30 23:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4a43e052de886824a29774277c86040a2b14f6f1 [^]
2013-10-31 12:55alostaleTag Attached: Performance
2013-10-31 12:55alostaleNote Added: 0061998
2013-10-31 12:55alostaleStatusresolved => closed
2013-10-31 12:55alostaleFixed in Version => 3.0MP29
2013-11-01 01:07hudsonbotCheckin
2013-11-01 01:07hudsonbotNote Added: 0062014

Notes
(0061990)
hgbot   
2013-10-30 23:54   
Repository: erp/devel/pi
Changeset: 4a43e052de886824a29774277c86040a2b14f6f1
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Wed Oct 30 18:52:53 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/4a43e052de886824a29774277c86040a2b14f6f1 [^]

Fixed 25051: Improve alertbackground process with high number of alerts.
Improve performance of that process when it need to process a high number
of alerts created by an alertrule.
Push down the check if that alert has already been inserted into ad_alert
into the query getting the alerts instead of doing many small queries.

---
M src/org/openbravo/erpCommon/ad_process/AlertProcess.java
M src/org/openbravo/erpCommon/ad_process/AlertProcess_data.xsql
---
(0061998)
alostale   
2013-10-31 12:55   
Code reviewed + verified
(0062014)
hudsonbot   
2013-11-01 01:07   
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/2d6c59f6dc4a [^]

Maturity status: Test