Openbravo Issue Tracking System - Retail Modules
View Issue Details
0048850Retail ModulesWeb POSpublic2022-03-21 12:232022-04-06 16:22
idiez 
rqueralta 
highmajoralways
closedfixed 
5
 
RR22Q3 
No
0048850: Performance JSONProcessSimple, request to load AWO tasks
Version: Openrbavo version 3.0 PR20Q4.
I do not add the different steps, I simply want to comment on a performance problem that the client is reporting to us when loading several tasks of a user in AWO.
We have debugged and added logs to see where those performance issues were.

So, the java that calls from AWO to load the tasks is the TasksProvider.
This extends from JSONProcessSimple, and there we have detected that the slowness is in the .toString of the JSON that it builds.
What I don't understand very well is why the following lines/checks are made:

String s = exec(jsonsent).toString();
checkTimeout();
if (s.startsWith("{") && s.endsWith("}")) {
// write only the properties, brackets are written outside.
JSONObject response = new JSONObject(s);
JSONObject contextInfo = getContextInformation();
.........

At the first point, it collects the response returned by the exec (in this case the one running in TasksProvider.class), and passes it to a String, just to check if it starts and ends with '{' '}', and then returns to pass that String to JSONObject.
So I have made the following change in my local environment:

JSONObject response = exec(jsonsent);
checkTimeout();
if (response != null) {
// write only the properties, brackets are written outside.
JSONObject contextInfo = getContextInformation();
............

With this we save the first .toString, and this lowers the response time to 10 seconds. I attach the times with the standard java, and with the changes made:

5888 MILISECONDS kill EXEC of taskprovider
12436 MILISECONDS finish EXEC tostring
14267 MILISECONDS before second tostring
23214 MILISECONDS after second tostring
24067 MILISECONDS after substring
24881 MILISECONDS after WRITE

With the change made:

5674 MILISECONDS kill EXEC of taskprovider
5674 MILISECONDS before second tostring
12528 MILISECONDS after second tostring
12634 MILISECONDS after substring
13372 MILISECONDS after WRITE

The client made a small diff with this change to apply it to our client, to see if it helps to load the tasks faster.
Diff proposed by the client
No tags attached.
diff jsonprocesssimple.diff (880) 2022-03-21 12:23
https://issues.openbravo.com/file_download.php?file_id=16792&type=bug
Issue History
2022-03-21 12:23idiezNew Issue
2022-03-21 12:23idiezAssigned To => staffrm
2022-03-21 12:23idiezFile Added: jsonprocesssimple.diff
2022-03-21 12:37PracticsIssue Monitored: Practics
2022-03-21 15:27marvintmProjectMantis @ OB => Retail Modules
2022-03-21 15:27marvintmTriggers an Emergency Pack => No
2022-03-21 15:27marvintmCategoryOthers => Web POS
2022-03-21 15:27marvintmTypedesign defect => defect
2022-03-22 06:09priyamAssigned Tostaffrm => Retail
2022-03-27 20:59rqueraltaAssigned ToRetail => rqueralta
2022-03-27 21:00rqueraltaStatusnew => scheduled
2022-03-28 11:26shuehnerIssue Monitored: shuehner
2022-03-30 17:24hgbotNote Added: 0136183
2022-04-06 16:21hgbotResolutionopen => fixed
2022-04-06 16:21hgbotStatusscheduled => closed
2022-04-06 16:21hgbotFixed in Version => RR22Q3
2022-04-06 16:21hgbotNote Added: 0136369
2022-04-06 16:22hgbotNote Added: 0136370

Notes
(0136183)
hgbot   
2022-03-30 17:24   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/348 [^]
(0136369)
hgbot   
2022-04-06 16:21   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: be864979a5191e7c09f86a643ba8541b5b4c4736
Author: Rafael Queralta <rafaelcuba81@gmail.com>
Date: 06-04-2022 14:21:41
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/be864979a5191e7c09f86a643ba8541b5b4c4736 [^]

Fixed BUG-48850: Removed the slowness in the .toString of the JSON call

---
M src/org/openbravo/mobile/core/process/JSONProcessSimple.java
---
(0136370)
hgbot   
2022-04-06 16:22   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/348 [^]