Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0047511 | Openbravo ERP | A. Platform | public | 2021-08-06 08:50 | 2021-09-15 09:25 |
Reporter | alostale | ||||
Assigned To | alostale | ||||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | PR21Q4 | |||
Merge Request Status | approved | ||||
Review Assigned To | |||||
OBNetwork customer | No | ||||
Web browser | |||||
Modules | Core | ||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0047511: Entity.getProperty generates too much memory garbage | ||||
Description | Profiling JVM object allocation raises there are many byte[] allocations in Entity.getProperty method. These allocations come from String concatenation to generate an error message in case the requested property does not exist. Note even the method is not expensive itself, it is invoked many times resulting in the top object allocator. | ||||
Steps To Reproduce | 1. Start recording with JDK Mission Control's Flight Recorder [1] 2. Ie. in POS create 4 time a ticket with 4 product and pay it 3. Check Flight Recorder results. -> It warns about byte[] allocation in Allocated Classes section -> In Memory details (see attached no-fix.png) check a total of ~250MB byte[] where allocated, checking the stack traces, it can be seen the main contributor for this allocation is Entity.getProperty. [1] https://www.oracle.com/java/technologies/jdk-mission-control.html [^] | ||||
Proposed Solution | Optimize messages to be generetad only if required. 2 alternatives: 1. Overload Check.isNotNull to support a message Supplier: Check.isNotNull(prop, () -> "Property " + propertyName + " does not exist for entity " + this)); 2. Do the check null directly in Entity.getProperty Even alternative 1 reduces a lot the byte[] allocation, lambdas are allocated. Being a method that is invoked all the time, 2nd alternative is more optimal (although a bit dirtier from the code point of view). Attached image (fix2.png) of the 2nd alternative executing the same steps as described above. | ||||
Additional Information | |||||
Tags | Performance | ||||
Relationships | |||||
Attached Files | ![]() https://issues.openbravo.com/file_download.php?file_id=16075&type=bug ![]() https://issues.openbravo.com/file_download.php?file_id=16076&type=bug | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2021-08-06 08:50 | alostale | New Issue | |||
2021-08-06 08:50 | alostale | Assigned To | => platform | ||
2021-08-06 08:50 | alostale | OBNetwork customer | => No | ||
2021-08-06 08:50 | alostale | Modules | => Core | ||
2021-08-06 08:50 | alostale | Triggers an Emergency Pack | => No | ||
2021-08-06 08:50 | alostale | Assigned To | platform => alostale | ||
2021-08-06 08:50 | alostale | Tag Attached: Performance | |||
2021-08-06 08:52 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=22980#r22980 | ||
2021-08-06 08:54 | alostale | File Added: no-fix.png | |||
2021-08-06 08:55 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=22981#r22981 | ||
2021-08-06 08:57 | alostale | Proposed Solution updated | |||
2021-08-06 08:58 | alostale | File Added: fix2.png | |||
2021-08-06 09:34 | hgbot | Merge Request Status | => open | ||
2021-08-06 09:34 | hgbot | Note Added: 0130999 | |||
2021-09-15 07:46 | alostale | Summary | Entity.getProperty generates too memory garbage => Entity.getProperty generates too much memory garbage | ||
2021-09-15 09:03 | hgbot | Merge Request Status | open => approved | ||
2021-09-15 09:25 | hgbot | Resolution | open => fixed | ||
2021-09-15 09:25 | hgbot | Status | new => closed | ||
2021-09-15 09:25 | hgbot | Fixed in Version | => PR21Q4 | ||
2021-09-15 09:25 | hgbot | Note Added: 0131800 | |||
2021-09-15 09:25 | hgbot | Note Added: 0131801 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|