I'm currently working on a project which is build as a microservice architecture.
We have one "Gateway" which aggregates the data coming from the different microservices to return one aggregated result to the frontend. The "Gateways" exposes GraphQL queries and mutations to CRUD data.
The microservices are build using java and spring boot and expose several REST API endpoints.
The problem I'm currently facing happens when it comes to generate a aggregate report.
For example:
- Fronted queries all orders within a time span
- Orders microservice returns a List of orders containing a list of products and a customer reference
- Now for each product in one order a GET to the product micro services is invoked to get the product data. That means if an order contains 10 products 10 GET requests are created to get the data.
- Same goes to the customer reference. A GET request is invoked to get the concrete data of the customer from the customer micro service
Now if we imagine we want to query all orders of the last month this ends up in a long-running query which might run in a timeout.
I know that microservices in general do not claim to be fast and that this is not their main purpose. But the current situation is not sustainable.
Are there any ideas to improve the performance without re-implementing the whole project?
Sorry if this is the wrong stack network for such questions.