Openbravo Issue Tracking System - Retail Modules
View Issue Details
0056788Retail ModulesWeb POSpublic2024-10-15 14:042024-12-09 15:48
malsasua 
meriem_azaf 
normalmajoralways
closedfixed 
5
 
 
approved
Gold
No
0056788: Performance problem on KernelUtils.getModulesOrderedByDependency
the function getModulesOrderedByDependency in KernelUtils is not efficient:
https://gitlab.com/openbravo/product/openbravo/-/blob/release/24Q4/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java?ref_type=heads#L275 [^]

This function is executed for each login, and when a lot of logins are done simultaneously after restart tomcat, it could cause a performance issue
restart tomcat and do multiple logins simultaneously
similar fix to
https://issues.openbravo.com/view.php?id=49546 [^]
No tags attached.
Issue History
2024-10-15 14:04malsasuaNew Issue
2024-10-15 14:04malsasuaAssigned To => Retail
2024-10-15 14:04malsasuaOBNetwork customer => Gold
2024-10-15 14:04malsasuaTriggers an Emergency Pack => No
2024-10-15 17:07malsasuaDescription Updatedbug_revision_view_page.php?rev_id=28593#r28593
2024-10-15 17:07malsasuaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=28595#r28595
2024-10-17 06:45guillermogilAssigned ToRetail => Triage Platform Base
2024-10-17 11:18AugustoMauchAssigned ToTriage Platform Base => malsasua
2024-10-17 11:19AugustoMauchNote Added: 0170525
2024-10-17 11:20AugustoMauchStatusnew => feedback
2024-10-30 08:50malsasuaNote Added: 0171136
2024-10-30 08:50malsasuaNote Deleted: 0171136
2024-10-30 08:50malsasuaNote Added: 0171137
2024-10-30 08:50malsasuaStatusfeedback => new
2024-11-18 12:04guillermogilAssigned Tomalsasua => Triage Platform Base
2024-11-21 09:06malsasuaNote Added: 0172380
2024-11-29 12:23AugustoMauchStatusnew => scheduled
2024-11-29 12:23AugustoMauchAssigned ToTriage Platform Base => meriem_azaf
2024-11-29 15:35hgbotMerge Request Status => open
2024-11-29 15:35hgbotNote Added: 0172780
2024-12-09 15:48hgbotMerge Request Statusopen => approved
2024-12-09 15:48hgbotResolutionopen => fixed
2024-12-09 15:48hgbotStatusscheduled => closed
2024-12-09 15:48hgbotNote Added: 0173077
2024-12-09 15:48hgbotFixed in Version => PR25Q1
2024-12-09 15:48hgbotNote Added: 0173078

Notes
(0170525)
AugustoMauch   
2024-10-17 11:19   
@Miguel, what you report is surprising because getModulesOrderedByDependency is caching the result, so even if it is executed often, it will only be costly once: https://gitlab.com/openbravo/product/openbravo/-/blob/master/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java#L252. [^]

Can you share with us the research that was done to determine getModulesOrderedByDependency is causing performance problems?
(0171137)
malsasua   
2024-10-30 08:50   
In the jstack, we saw dozens of threads halted during the process.

The issue occurred because Tomcat was restarted while the stores were open. As a result, when Tomcat started, a large number of login requests came in simultaneously.
(0172380)
malsasua   
2024-11-21 09:06   
Checked with platform team: The KernelUtils.getModulesOrderedByDependency function is cached during the first login.

Possible root cause: If the function takes a few minutes to execute and a significant number of login requests arrive simultaneously after a Tomcat restart, it could result in all threads waiting at this point.

Possible fix: Cache the result of the function when Tomcat starts. While this might slow down the Tomcat startup process, it could prevent thread blockage during login bursts.
(0172780)
hgbot   
2024-11-29 15:35   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1464 [^]
(0173078)
hgbot   
2024-12-09 15:48   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: ef184b1dd931f9c2d4db10b49ea30b9d6216eef5
Author: meriem azaf <m.azaf@orisha.com>
Date: 09-12-2024 14:18:33
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/ef184b1dd931f9c2d4db10b49ea30b9d6216eef5 [^]

Fixes ISSUE-56788: Performance problem on KernelUtils.getModulesOrderedByDependency

The function getModulesOrderedByDependency in KernelUtils is not efficient,this function is executed for each login, and when a lot of logins are done simultaneously after restart tomcat, it could cause a performance issue.

To fix it, we change this function to be synchronized.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
---
(0173077)
hgbot   
2024-12-09 15:48   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1464 [^]