Answer the question
In order to leave comments, you need to log in
Can two microservices that perform similar business logic access the same database?
Good day everyone. Experienced DevOps tell me)) Can two microservices be dependent on each other so that they have a common database?
In short. Is there one service (let's give it a conditional name A) on which the Socket.io server is spinning, and it processes all socket events and partially it needs access to the database with all the logic related to the rooms?
And there is a second service (let's give it a conditional name B), which fully implements the business logic of the rooms and their functionality.
For example. A user has decided to create a new room. He sends a request to service B in order to save the room he created (an array of connections is stored in the model of this room). Next, the user must connect to this room, and he will already trigger the joinRoom event on service A. Service A must save the connected user to the room. And for such a situation, I think we need a common base. Is it possible to do so? And what are the disadvantages of this? Thanks in advance
Answer the question
In order to leave comments, you need to log in
Do not produce unnecessary microservices. It will be more difficult for you to debug and test.
As per your question, it is bad practice to use one db in different microservices.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question