N
N
Nastya19202020-07-05 15:55:53
Java
Nastya1920, 2020-07-05 15:55:53

How to competently parallelize threads for a complex query?

There are several microservices. For example, the user-account service: at the stage of executing the user deletion method, 4 more requests are made to other services in order to clean his traces from all related databases.
Of course, this makes the execution time-consuming.
Question: inside the removeUser request, is each of the inner @Async requests with a future return sufficient? And add the taskExecutor bean to the application by setting a large number of threads in the pool?
To clarify, the removeUser method must wait for responses from external databases before the front can get its status code. That is, you need to know for sure that everything is cleaned, and not in the process.
Or is there a better way to accomplish this goal?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question