Reputation: 754
Say I have a microservice A and it has 3 instances. Similarly for microservice B there are 5 instances of B service.
I will have separate DB for Microservice A and B that is fine. But is it necessary to have separate db instance for each microservice instance of A or B?
I mean to say for the 3 instances of Microservice A, do I need to have 3 separate instances of db? Or all the instances of A will point to one db instance? Which is better approach?
Upvotes: 0
Views: 316
Reputation: 1046
The question is broad and there is no better or worst approach it purely depends on your use cases and user load.
From your question I understood you need to spawn separate instances of a single microservice, so ideally all instances of service A should have access to same data. You can create multi master architecture in which you can connect your services to each replica by setting up a multi master data base. This articles gives you an overview on it scale-out-blog. However doing this will be having many implication and you need to carefully design your services to achieve this.
You can also create separate instances pointing to same DB in which you don't need to care about replication and other complex issues.
Upvotes: 2