We have a high read and low writing website that currently has a monolithic architecture on the backend.
We have recently started to divide it into microservices.
We have designed some microservices – Product, Price, Offers, Content (images, videos, etc.).
There is another microservice – "Recommend". This service runs logic and provides similar product identifiers for a given product identifier.
On our product page, we want to show the product details, prices, offers and an image. This is very similar to the Amazon product page.
This part seems quite simple because we call all microservices in parallel and compose the required entity.
The next section is about "Similar Products", which presents the basic details of several similar products. This section is similar to the "Sponsored Products" section of Amazon.
Now, according to our current approach, we first call the "Recommend" service which returns the list of product identifiers. Then we send these credentials to all other microservices to get the details of their products, their prices, their offers and their image.
This approach works well but it has some points of discussion:
Some microservice calls depend on others. We have to wait for the first call to finish before we can start with the others. As far as I've read, people say that all microservice calls should be as independent as possible.
Is it even the right approach? Could there be a better approach such as:
I. Another service that performs this composition and caches the composed data. But now, this new service will have to listen to the changes of all microservices and invalidate the cache accordingly. This approach improves overall performance.
ii. Synchronize some important traffic data, such as prices, with the product microservice, but this increases the complexity and makes the microservices more or less dependent on each other, which goes against the principles of microservice.
Would like to know what others are doing in such cases.
I checked on StackExchange but I did not find anything like my problem.
Something similar – How to query data from multiple microservices
Thanks in advance!