Is there any solution to whether the node micro-services architecture will reduce the efficiency and response time of the back end?

problem description

recently, we are building a data processing system using node, which involves a large number of modules, so we intend to use a micro-service architecture, and currently use a micro-services framework, Seneca, to communicate with tcp.

Seneca microservices are mainly responsible for communicating with db, as well as data processing computing (not very time-consuming computing).

most of the data processing and calculation work here can be delayed, but the return of the front-end http is related to some of the work, such as database query, so you need to wait for some micro-service modules to return the results (or part of the results) before returning to the front-end.
so through the ab test, I found that using Seneca is much less efficient than the original way in which the modules are written together and directly introduced, and in worse cases, the average response time is even 1.5 times that of the original.
this is not difficult to understand, after all, there will be communication overhead, and there may be other hidden costs due to the adoption of Seneca.

I am a little confused now. If I use micro-service, it can decouple the modules and make it convenient for development, but it will reduce the efficiency and feel that the loss outweighs the gain.
I don"t have a deep understanding of micro-services. I just think it can bring benefits to this single system in terms of code maintenance. In addition, it is easy to expand the capacity of a single service of micro-services.

am I using it in the wrong way? Or is it that microservices already have the problem of reducing efficiency? How did you solve the problem? I hope I can give you some advice.

May.22,2021

your understanding is correct. Microservices are inherently inefficient. But why do we still use microservices? The answer is obvious, and you put forward it yourself: decoupling. But it cannot be decoupled for the sake of decoupling, decoupling is also purposeful, and the purpose is not just for the convenience of development. Without microservices, all your modules have to run on the same host. What if you have too many modules, take up too much memory and consume too much CPU? At this time, you are bound to separate some modules and put them on another server. At this time, there is a demand for micro-services. The two servers must communicate through the network. In any case, the two modules that communicate through the network will be slower than the two modules running on the same server. But the architecture is such an architecture, and all that remains is the question of how to improve the speed, such as adding some caches, load balancing and so on.

Menu