Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0035838Openbravo ERPA. Platformpublic2017-04-25 18:242018-01-03 12:38
JONHM 
inigosanchez 
urgentminorsometimes
closedfixed 
5
 
3.0PR18Q1 
alostale
Core
No
0035838: Bad performance in alert window when having +20000 records in ad_alert and many of them are solved
When having +200000 records in ad_alert, and many of them are solved, it causes a performance issue.
- In an environment with +200000 alerts

1) Login with Openbravo user and press the [Alert] button on the top of the screen
2) It shows a timeout: 'no records to show' while java is consuming the memory causing a performance issue
Filter by not solved alerts in the getWhereAndFilterClause() function of ADAlertDatasourceService class
Performance
related to defect 0036605 closed inigosanchez unneeded datasource requests opening alert management window 
related to defect 0037214 closed inigosanchez It is possible to produce a server crash executing on the sql query window a query returning thousands of records 
Issue History
2017-04-25 18:24JONHMNew Issue
2017-04-25 18:24JONHMAssigned To => platform
2017-04-25 18:24JONHMModules => Core
2017-04-25 18:24JONHMResolution time => 1494885600
2017-04-25 18:24JONHMTriggers an Emergency Pack => No
2017-04-25 18:25JONHMResolution time1494885600 =>
2017-04-25 18:25JONHMSeveritymajor => minor
2017-04-26 08:28alostaleTag Attached: Performance
2017-04-26 08:28alostaleStatusnew => acknowledged
2017-08-04 12:34alostaleRelationship addedrelated to 0036605
2017-08-04 12:50alostalePriorityhigh => urgent
2017-10-24 10:47inigosanchezStatusacknowledged => scheduled
2017-10-24 10:47inigosanchezAssigned Toplatform => inigosanchez
2017-11-06 13:12alostaleRelationship addedrelated to 0037214
2017-11-09 10:01hgbotCheckin
2017-11-09 10:01hgbotNote Added: 0100370
2017-11-09 10:01hgbotStatusscheduled => resolved
2017-11-09 10:01hgbotResolutionopen => fixed
2017-11-09 10:01hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4524f5da317f97b8510233fd4d905982e0c4d53a [^]
2017-11-09 10:06inigosanchezReview Assigned To => alostale
2017-11-10 11:54hgbotCheckin
2017-11-10 11:54hgbotNote Added: 0100420
2017-11-10 11:56alostaleNote Added: 0100421
2017-11-10 11:56alostaleStatusresolved => closed
2017-11-10 11:56alostaleFixed in Version => 3.0PR18Q1
2017-11-10 12:49inigosanchezNote Added: 0100422
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101387
2018-01-03 12:38hudsonbotCheckin
2018-01-03 12:38hudsonbotNote Added: 0101400

Notes
(0100370)
hgbot   
2017-11-09 10:01   
Repository: erp/devel/pi
Changeset: 4524f5da317f97b8510233fd4d905982e0c4d53a
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Wed Nov 08 12:25:15 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/4524f5da317f97b8510233fd4d905982e0c4d53a [^]

Fixes issue 35838: Improved the performance in Alert Management window

When you had several alerts (the problem was reported with +20000 alerts) and the Alert Management
window was opening, there was a performance problem: The alerts weren't show, java was consuming
the memory,etc.

Several refactors and improvements have been done in order to improve the performance in Alert
Management window:

- The getWhereAndFilterClause method was performing twice per alert status. It is removed the
invocation from the fetch method in ADAlertDatasourceService because it is done in the fetch method
of the super class.
- It is not neccesary to retrieves the full alert object when only the alert ID is needed. The same
for AlertRule.
- Now the status of the alert is take into account in the queries in order to retrieves from the DB
only the alerts that should be needed.
- StringBuilder is used instead of String when concatenate several IDs.

Now the performance of the window is improvement a lot. For example, having more than 20000 alerts,
it has been reduce the time from 40.1 seconds to 0.6 seconds (Times in DataSourceServlet.doFetch)
showing to the user the same information.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/ADAlertDatasourceService.java
---
(0100420)
hgbot   
2017-11-10 11:54   
Repository: erp/devel/pi
Changeset: 873652fe3cd4485c3011e2369ebcea703895a3e6
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Nov 10 11:49:58 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/873652fe3cd4485c3011e2369ebcea703895a3e6 [^]

related with bug 35838: performance issues in Alert window

  Some minor code clean up:
   - Format SQL to make it more readable
   - Removed clutter + duplicity handling elements in map
   - Use parameterized statements instead of string concatenation to generate query
   - Prevent expensive debug message generation if it won't be logged

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/ADAlertDatasourceService.java
---
(0100421)
alostale   
2017-11-10 11:56   
reviewed + tested
(0100422)
inigosanchez   
2017-11-10 12:49   
Times in DataSourceServlet.doFetch having more than 20000 Alerts:
- Open Alert Management window. Before: 40100 ms. After improvements: 600 ms.
(0101387)
hudsonbot   
2018-01-03 12: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/c81e0d3cbab5 [^]
Maturity status: Test
(0101400)
hudsonbot   
2018-01-03 12: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/c81e0d3cbab5 [^]
Maturity status: Test