Openbravo Issue Tracking System - Retail Modules
View Issue Details
0049558Retail ModulesWeb POSpublic2022-06-15 11:282022-08-22 14:23
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
 
No
0049558: Performance problem on LabelsComponent.getMobileAppDependantModuleIdList
A client recently had some performance problem caused in part by the implementation of the LabelsComponent.getMobileAppDependantModuleIdList. That method is invoked every time a user opens the login screen, as part of the request done to MobileCoreLoginUtilsServlet. Given a module id, the method returns the list of modules that depend from it.


There are two problems in that method:
- Even though that information is not going to change until a new module is installed (and that requires rebuilding the app and restarting tomcat), it is computed everytime, when it could be cached
- At some point the method wants to check if two modules are the same, and instead of comparing their IDs, it is comparing the whole module object, and doing that requires hibernate to inialize the whole object

This issue is not easy to reproduce because it requires lots of simultaneous login requests on an environment that is already under heavy load.

We were able to find out what the problem was by analyzing the jstack log. You can find in the attached jstack file that there were several threads working on the getMobileAppDependantModuleIdList function, in particular in the BasicLazyInitializer class as a result of comparing whole module objects instead of just their ids
- When comparing modules, compare their ids instead of the whole object
- Cache the list of dependencies of each requested module instead of compute it every time a user logs in
No tags attached.
depends on backport 0050024RR22Q2.3 closed AugustoMauch Performance problem on LabelsComponent.getMobileAppDependantModuleIdList 
has duplicate defect 0049546 closed Retail the function getDependantModules is not efficient 
related to design defect 0053470 new Triage Platform Base Bad translation between the 2 nodes 
txt jstack-2022-06-13_12.45.01.txt (264,932) 2022-06-15 11:28
https://issues.openbravo.com/file_download.php?file_id=17163&type=bug
Issue History
2022-06-15 11:28AugustoMauchNew Issue
2022-06-15 11:28AugustoMauchAssigned To => AugustoMauch
2022-06-15 11:28AugustoMauchTriggers an Emergency Pack => No
2022-06-15 11:28AugustoMauchFile Added: jstack-2022-06-13_12.45.01.txt
2022-06-15 11:31AugustoMauchSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=24295#r24295
2022-06-15 11:31AugustoMauchProposed Solution updated
2022-06-15 11:31AugustoMauchStatusnew => scheduled
2022-06-15 11:52AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=24297#r24297
2022-06-15 11:58hgbotNote Added: 0138364
2022-06-16 18:55hgbotResolutionopen => fixed
2022-06-16 18:55hgbotStatusscheduled => closed
2022-06-16 18:55hgbotFixed in Version => RR22Q3
2022-06-16 18:55hgbotNote Added: 0138444
2022-06-16 18:55hgbotNote Added: 0138445
2022-06-17 07:08marvintmRelationship addedhas duplicate 0049546
2022-08-22 14:15AugustoMauchNote Added: 0140295
2022-08-22 14:15AugustoMauchStatusclosed => new
2022-08-22 14:15AugustoMauchResolutionfixed => open
2022-08-22 14:15AugustoMauchFixed in VersionRR22Q3 =>
2022-08-22 14:16AugustoMauchStatusnew => scheduled
2022-08-22 14:23AugustoMauchStatusscheduled => resolved
2022-08-22 14:23AugustoMauchResolutionopen => fixed
2022-08-22 14:23AugustoMauchStatusresolved => closed
2024-03-18 13:14alostaleRelationship addedrelated to 0053470

Notes
(0138364)
hgbot   
2022-06-15 11:58   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/379 [^]
(0138444)
hgbot   
2022-06-16 18:55   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: d1ff623e09ebf3f2b6bc79084ba62f2c46606508
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 15-06-2022 12:15:28
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/d1ff623e09ebf3f2b6bc79084ba62f2c46606508 [^]

Fixes ISSUE-49558: Improves performance of LabelsComponent.getMobileAppDependantModuleIdList

Two improvements have been done:
- List of dependencies of a given module is now cached
- When comparing modules, its ids are compared instead of the whole object

---
M src/org/openbravo/mobile/core/login/LabelsComponent.java
---
(0138445)
hgbot   
2022-06-16 18:55   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/379 [^]
(0140295)
AugustoMauch   
2022-08-22 14:15   
Reopened to create backports