Consume REST service performance

1
Hi In our applications we extensively make use of REST services to provide the business data in the mendix application. For instance when a user logs in, a service is called to get a list of customers and contracts linked to this user from our backend systems. The result is mapped to persistent entities and presented on pages in a listview. The reason for usage of persistent entities is because the search en sort capabilities of datagrids and listviews widgets require persistent entities. But when the REST service returns a list of 3000 customers for a user, the microflows takes to much time to map the REST response to the persistent entities. The steps that are executed in the microflow when logging in are : 1. find and delete all customer and contract objects linked to the user Account object, 2. call the REST service 3. recreate all customer and contract objects and link associate this with the user Account object. This is done by looping over the 3000 REST model  objects, map these to new created customer and contract objects en commit as a list of new objects to the database.    How should we solve this properly?
asked
2 answers
1

Does the REST service support paging?

You're most likely not showing the 3000 objects at once. In that case, you could retrieve the first 100 customers directly and then retrieve the rest of the customers with a background process. Meanwhile informing the user that results are still being processed.

answered
0

Hi Olivier,

  I suspect that both a non-persistent and persistent entity would take a while to accomplish this retrieve.  That just sounds like a complex operation.  If the users are frustrated that they have to sit there and wait while the microflow executes, consider executing your REST call and mapping in the background using the action ExecuteMicroflowInBackground from the CommunityCommons module.  You could redirect users to a dashboard with some available data or metrics while the account data loads in the background. This, in combination with Dorus' suggestion about paging, may provide a better user experience.

answered