Anonymous Asked in Cars &Transportation · 2 weeks ago

Is it a good idea for microservices to share a common database?

I've seen folks refer to this idea in part, trivially, as “each microservice should own and control its own database and no two services should share a database.” The idea is sound: don't share a single database across services because then you run into conflicts like competing read/write patterns, data-model conflicts . 14 июл. 2016 г.


Should microservices share a database?

Fundamentals. By definition, microservices should be loosely coupled, scalable, and independent in terms of development and deployment. Therefore, the database per service is a preferred approach as it perfectly meets those requirements.

Can we use same database in microservices?

Yes, it's possible to integrate a database for microservices. You can create a single shared database with each service accessing data using local ACID transactions.

Should microservices share common code?

The general guideline in microservices is to not share code. Things that can be shared are libraries that don't changed very often like US States, color, etc. To answer your question what about the code for the communication between the microservices , I would say not to share this code.

Related Questions

Relevance
Write us your question, the answer will be received in 24 hours