Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Revisions: Issue #37455 Back to Issue ]
Summary 0037455: Detected slow piece of code in LoginUtils
Revision 2017-12-14 12:20 by vmromanos
Steps To Reproduce Login in the ERP
Open developer tools
Change the role to a role with access to many organizations
Verify this piece of code is slow.
Revision 2017-12-14 12:20 by vmromanos
Description 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 a bit slow and could be improved.

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;
                }
              }
            }
          }
        }

The system searches for a valid acct schema using a dummy algorithm. If we search using a smarter way, we could improve the performance of this piece.
Revision 2017-12-14 12:05 by vmromanos
Steps To Reproduce 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
Revision 2017-12-14 12:05 by vmromanos
Description 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;
                }
              }
            }
          }
        }


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker