Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037456Openbravo ERP01. General setuppublic2017-11-13 10:092017-12-12 12:11
Sandrahuguet 
AtulOpenbravo 
normalmajorhave not tried
closedfixed 
30Openbravo Appliance 14.04
 
3.0PR17Q43.0PR17Q4 
vmromanos
Core
No
0037456: Change the role in the ERP has performance problems
In an environment with many organizations, get General Ledger of context organizations part in LoginUtils.java (specifically, the loop by organization and selectAcctSchema inside) is very slow (takes around 17s).

slow part:

        // Get General Ledger of context organizations
        if (ArrayUtils.isEmpty(attr)) {
          String[] orgList = Utility.getContext(conn, vars, "#User_Org", "LoginHandler")
              .replace("'", "").split(",");
          for (String orgId : orgList) {
            if (!StringUtils.equals(orgId, strOrg)) {
              acctSchemaId = OBLedgerUtils.getOrgLedger(orgId);
              if (StringUtils.isNotEmpty(acctSchemaId)) {
                attr = AttributeData.selectAcctSchema(conn, acctSchemaId,
                    Utility.getContext(conn, vars, "#User_Client", "LoginHandler"));
                if (ArrayUtils.isNotEmpty(attr)) {
                  break;
                }
              }
            }
          }
        }
Login in the ERP
Open developer tools
Change the role to a role with access to many organizations
Notice that UserInfoWidgetActionHandler request takes around 18s
No tags attached.
blocks defect 0037277 closed AtulOpenbravo Change the role in the ERP has performance problems 
Issue History
2017-12-12 10:17AtulOpenbravoTypedefect => backport
2017-12-12 10:17AtulOpenbravoTarget Version => 3.0PR17Q4
2017-12-12 10:20AtulOpenbravoNote Added: 0100975
2017-12-12 12:09hgbotCheckin
2017-12-12 12:09hgbotNote Added: 0100980
2017-12-12 12:09hgbotStatusscheduled => resolved
2017-12-12 12:09hgbotResolutionopen => fixed
2017-12-12 12:09hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR17Q4/rev/272695c75c880b0a9bdc11c83f78a04b1bb16d35 [^]
2017-12-12 12:11vmromanosReview Assigned To => vmromanos
2017-12-12 12:11vmromanosStatusresolved => closed
2017-12-12 12:11vmromanosFixed in Version => 3.0PR17Q4

Notes
(0100975)
AtulOpenbravo   
2017-12-12 10:20   
Time logs in local instance with similar setup as in client environment

500+ organizations with General Ledger having no dimensions or no active dimensions defined.

Before any Fix
At first login
Time taken to fetch general ledger of context org (ms):- 426
Time taken to fetch general ledger of context org (ms):- 464

Changing role from System Admin to Client Admin
Run#1
Time taken to fetch general ledger of context org (ms):- 7587
Run#2
Time taken to fetch general ledger of context org (ms):- 7191
Run#3
Time taken to fetch general ledger of context org (ms):- 7134
Run#4
Time taken to fetch general ledger of context org (ms):- 6800

GUI: ~ 8.5 to 9 seconds

After Fix issue-37277.diff
At first login
Time taken to fetch general ledger of context org (ms):- 448
Time taken to fetch general ledger of context org (ms):- 537
Changing role from System Admin to Client Admin

Run#1
Time taken to fetch general ledger of context org (ms):- 215 Org count visited..541
Run#2
Time taken to fetch general ledger of context org (ms):- 196 Org count visited..541
Run#3
Time taken to fetch general ledger of context org (ms):- 213 Org count visited..541
Run#4
Time taken to fetch general ledger of context org (ms):- 153 Org count visited..541

GUI: ~ 2.5 to 3 seconds


With both the fixes
At first login
Total Time (ms): General Ledger of context organizations: 110

Changing role from System Admin to Client Admin
Run#1
Total Time (ms): General Ledger of context organizations: 97
Run#2
Total Time (ms): General Ledger of context organizations: 73
Run#3
Total Time (ms): General Ledger of context organizations: 55
Run#4
Total Time (ms): General Ledger of context organizations: 54

GUI: ~ 2 to 2.5 seconds
(0100980)
hgbot   
2017-12-12 12:09   
Repository: erp/backports/3.0PR17Q4
Changeset: 272695c75c880b0a9bdc11c83f78a04b1bb16d35
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Tue Dec 12 15:00:06 2017 +0530
URL: http://code.openbravo.com/erp/backports/3.0PR17Q4/rev/272695c75c880b0a9bdc11c83f78a04b1bb16d35 [^]

Fixes Issue 37456:Change the role in the ERP has performance
problems

** Flush is called before calling fillSessionArguments
** new ConnectionProvider without flush is passed to the
fillSessionArguments method which avoids flush for
every select statement which uses this connection Provider
as flush is not need for select statements.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java
---