Openbravo Issue Tracking System - Retail Modules
View Issue Details
0050024Retail ModulesWeb POSpublic2022-06-15 11:282022-08-31 10:09
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
RR22Q2.3RR22Q2.3 
No
0050024: 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.
blocks defect 0049558 closed AugustoMauch Performance problem on LabelsComponent.getMobileAppDependantModuleIdList 
Issue History
2022-08-22 14:16AugustoMauchTypedefect => backport
2022-08-22 14:16AugustoMauchTarget Version => RR22Q2.3
2022-08-22 14:21hgbotNote Added: 0140296
2022-08-31 10:09hgbotResolutionopen => fixed
2022-08-31 10:09hgbotStatusscheduled => closed
2022-08-31 10:09hgbotFixed in Version => RR22Q2.3
2022-08-31 10:09hgbotNote Added: 0140547
2022-08-31 10:09hgbotNote Added: 0140548

Notes
(0140296)
hgbot   
2022-08-22 14:21   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/398 [^]
(0140547)
hgbot   
2022-08-31 10:09   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: e15d307aebc28f6b2a74109729450c14c38a595d
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 31-08-2022 10:08:29
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/e15d307aebc28f6b2a74109729450c14c38a595d [^]

Fixes ISSUE-50024: 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
---
(0140548)
hgbot   
2022-08-31 10:09   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/398 [^]