Possible feedback on microflow to improve performance

0
Hi everyone, For an employee app I'm working on, I've created a microflow that retrieves data for an employee from the companies SAP S4/HANA backend. The first retrieve (when there is no data in the app) takes about 20 seconds for a 2138 record retrieve. A second retrieve to check for updates (0 records when ran directly after the first retrieve) takes about 10 seconds.  I've been talking to some SAP skilled people who blame the S4/HANA performance, but I want to make sure that my microflow is as quick as possible, even if the SAP system is not super quick. Who would be willing  look at the microflow and give some pointers on how to improve its performance?   Thank you in advance!   Regards, Bart van den Heuvel   Main microflow: https://modelshare.mendix.com/models/4b489c98-00db-4983-b432-def11eb8fabe/act_callsapodataconnector SUB_GetDataFromSAP: https://modelshare.mendix.com/models/7de0dcc4-aa52-46e0-9ad7-c97f0a2186b6/sub_getdatafromsap SUB_GetEmployee: https://modelshare.mendix.com/models/033ba942-61ef-40ad-9974-619f012131fd/sub_getemployee SUB_GetTimeSheetData: https://modelshare.mendix.com/models/b7bd76df-7d78-4cec-89df-79aa32df8555/sub_gettimesheetdata
asked
1 answers
0

At first glance, the microflow doesn't look 'underperforming' to me. I have found some points of attention though:

- Why would you want to retrieve the user object when you've already got the user loaded into memory as $CurrentUser? You're now retrieving exactly the same object. In the retrieve you can also check this because you're going 'back and forth' over the same association. I suggest you just use the $CurrentUser object and leave out the retrieve for user instead.

- When debugging, did you find the retrieve action for TimeSheetData to be rather slow? (Since I note that you retrieve ALL records) I don't have the whole context with regards to the domain model and the functionality but maybe there's a way for you to retrieve the timesheetdata in the loop itself. Because less objects are being retrieved, this could potentionally increase the execution speed of the microflow. Moreover, you also minimalise the number of objects that have to be loaded into memory this way which may be good in order to prevent OutOfMemory/Heap space errors.

- With regards to the 20 second retrieve; it could be that this doesn't have to do with this specific microflow. How many records exist in the database table you're retrieving data from? If this a large number then I suggest to look into adding indexes to your entity that represents that table. See also: https://docs.mendix.com/refguide/indexes

 

Hope this helps ;)

answered