Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microservices with common users table

Is it possible to design a microservice based architecture on which each microservice have separate independent database and a common users table?

like image 818
Omar Faruk Avatar asked May 23 '26 13:05

Omar Faruk


1 Answers

It is not recommended to share a database or a table between microservices. They should have distinct, well defined responsibilities and should communicate only using the network; the protocol must hide the technology used inside a microservice: for example you can use JSON for request/responses.

The reason you do this is that a microservice should not depend on the tehnology of another microservice as microservices should be easily replaced with other microservices that use other technology stack but fulfill the same purpose.

If you need data from one microservice in another you can make a:

  • synchronous call: this is easier to implement but is susceptible to cascade failure

  • asynchronous call: harder to implement but leads to a more resilient system

like image 105
Constantin Galbenu Avatar answered May 26 '26 09:05

Constantin Galbenu