I am encountering some problem of performance with an Angular application that is querying a backend via API endpoints.
It exposes an endpoint that I need to call a huge amount of time (>2000) as fast as possible.
Thus, I am iterating over a Set and for each item call a service which is calling an HttpClient get method. It looks aproximately like this :
this.itemList.forEach((item: Item) => {
this.itemWsService
.getItemComputation(item)
.subscribe(// callback method);
});
The problem is, I am not getting the performances I wish I get.
In order to understand what was slowing the application performances down, I measured :
The result (shown in the image below) is that I am receiving requests on backend many seconds after I execute the method within Angular.
My question is : Is Angular kind of waiting before firing the execution of get method call ? Might there be some bottleneck preventing http requests to be made in parallel ? How to avoid this ?
I am running the Angular frontend and the Java+Spring backend on the same machine and embedding the Angular into a native app using Electron.
Is Angular kind of waiting before firing the execution of get method call
No
Might there be some bottleneck preventing http requests to be made in parallel ?
Yes:
How to avoid this ?
You can probably tweak your browser settings to increase the limit. But the correct thing to do would be to redesign the API to avoid having to send 2000 concurrent requests in the first place.