15
Views
6
Comments
Solved
Speeding up 69 REST GET + POST calls (Reactive) — parallelization, batching
Application Type
Reactive
Service Studio Version
11.55.0 (Build 63850)

Scenario (Reactive Web): 

I need to call a REST GET API 69 times (one per ID) and append results to a list shown on the screen. After the GETs, I must call a REST POST API 69 times (one per ID) to create requests on an external system. The external API doesn’t support bulk payloads, only single-request parameters. 

Current behavior: 

GET loop (For Each) → UI reflects all data in ~30 seconds.

 POST loop (For Each) → 69 creates take ~3 minutes. 

Goal: 

Show the GET data in a few seconds (ideally <5s). 

Kick off the POST creates without blocking the UI (finish later, with progress), or complete significantly faster if possible.


Any suggestion/recommendation much appreciated.

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

A bit of math:

70 requests at 1 second each, means 70 seconds. If you are doing half of that, it is great. The back and forth is the main issue. The client shouldn't be the one doing the connection.


This is a common scenario and you will see many suggestions. The simplest one:

I would send all the Ids to the server and process them there.

The client would refresh the list every second to read what the server has, but not directly waiting for the service.

The POST is a bit slower, so you can have a BPT processing each completed GET and making the corresponding POST. They are independent.

2023-10-16 05-50-48
Shingo Lam

I think it is the same approach that I recommend, to save the process data on server and let server do it asynchronously by timer / BPT

2016-04-22 00-29-45
Nuno Reis
 
MVP

Yes, but timers always take a few seconds to start, so the 5 seconds goal would be impossible. GET on server action, POST on BPT is the fastest for this scenario.

With different amounts I would ignore the users wishes and move it to a timer for sure. If this is a 30 seconds run, it can be in the server action.

2023-10-16 05-50-48
Shingo Lam
Solution

In this situation, limitation from external API side. You can consider the background asynchronous approach, which means that 

  1. UI submit -> save the temporary data that we need to process
  2. Call background jobs like timers / BPTs
  3. UI respond something similar "your request is in progress, an email will be sent to you when it is completed"
  4. The Timers / BPTs logic is to get the temporary data and proceed with the api GET / POST as mentioned

Hope this workaround help

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

A bit of math:

70 requests at 1 second each, means 70 seconds. If you are doing half of that, it is great. The back and forth is the main issue. The client shouldn't be the one doing the connection.


This is a common scenario and you will see many suggestions. The simplest one:

I would send all the Ids to the server and process them there.

The client would refresh the list every second to read what the server has, but not directly waiting for the service.

The POST is a bit slower, so you can have a BPT processing each completed GET and making the corresponding POST. They are independent.

2023-10-16 05-50-48
Shingo Lam

I think it is the same approach that I recommend, to save the process data on server and let server do it asynchronously by timer / BPT

2016-04-22 00-29-45
Nuno Reis
 
MVP

Yes, but timers always take a few seconds to start, so the 5 seconds goal would be impossible. GET on server action, POST on BPT is the fastest for this scenario.

With different amounts I would ignore the users wishes and move it to a timer for sure. If this is a 30 seconds run, it can be in the server action.

2024-04-29 14-32-53
Abrar Khan

Hi @Shingo Lam , @Nuno Reis ,

Thanks for the suggestions! I implemented a similar pattern: I store request creation details in a single entity and trigger a background process on entity creation. The UI renders the GET results quickly, and the POSTs run asynchronously in parallel with controlled concurrency and retries. This decoupling improved responsiveness and reduced overall time, while progress and error states are visible in the UI. Appreciate the pointers that helped shape this solution!

2023-10-16 05-50-48
Shingo Lam

Great to hear that you can solve your issue

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.