0
votes

I'm in the process of designing a micro-service architecture and I have a performance related question. This is what I am trying out with my design:

  • I have a several micro-services which perform distinct actions and store those results in their own data-store.
  • The micro-services receive work via a message queue where they receive requests to run their process for the specific data given. The micro-services do NOT communicate with each other.
  • I have an API gateway which effectively has three journeys:

    1) Receive a request to process data which it then translates into several messages which it puts on the queue for the micro-services to process in their own time. The processing time can be in minutes or longer (not-instant)

    2) Receives a request for the status of the process, where it returns the progress of the overall process.

    3) Receives a request for combined data, which is some combination of all the results from the services.

My problem lies in #3 above and the performance of this process.

Whenever this request is received, the api gateway has to put a message request onto the queue for information from all the services, it than has to wait for all the services to reply with the latest state of their data and then it combines this data and returns to the caller.

This process is obviously rather slow as it has to wait for every service to respond. What is the way of speeding this up?

The only way I thought of solving this is having another aggregate service/data-store where duplicate data is stored and queried by my api gateway. I really don't like this approach as it duplicates data and is extra work/code.

What is the 'correct' and performant way of querying up-to-date data from my micro-services.

1

1 Answers

-2
votes

You can use these approach for Querying data across microservices. Reference
Selective data replication

With this approach, we replicate the data needed from other microservices into the database of our microservice. The only coupling between microservices is in the data replication configuration.

Composite service layer With this approach, you introduce composite services that aggregate data from lower-level microservices.