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 :
- date of execution of HttpClient get method call
- date of Http get request reception on the backend (using logback-access)
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.