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.