0

I am writing a microservices based NodeJS-Cassandra application and I haVe few services they would need 70% similar data( like username, avatar, videos, etc.) and I am just wondering to know is it a good idea that I create 2 databases like:

DB1:

A,B,C,D,E,F,G,H,I,J,K,L,M,N

DB2:

A,B,C,D,E,F,G,H,I,J,W,X,Y,Z

Or just create one database like:

A,B,C,D,E,F,G,H,I,J,K,L,M,N,W,X,Y,Z

I know from microservices concept that we should give it's own database to each service, but as long as my data contains some massive data like video files, I don't know what should I do in this specific case?

I like to know if there is any rule of thumb says "if your databases would have more than x-% of similar data, or the data you should replicate in both databases exceeds x-GB, it's better to keep them in 1 database"?

1
  • Without knowing more, I'd guess that the 70% shared functionality ought to be factored out into its own microservice. May 22, 2023 at 20:19

1 Answer 1

2

Generally speaking, enterprises I've worked with who have microservices architecture share a database backend. It is very rare to split the apps into their own database.

The times where I've seen it done is when there is a specific requirement to do so. Examples are:

  • two or more customers are competitors and the business rules require they be on separate infrastructure;
  • mandated security requirement by an enterprise;
  • regulatory and/or compliance.

As a side note, you are really asking for opinions instead of facts and this is discouraged on the Stack network. You should avoid asking this type of question since moderators are likely to close them down.

If you need guidance, see How to ask good questions and What questions to avoid asking. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.