Best solution to scale out/horizontal database for microservices


The main benefit of Microservices are one Service “Type” can be scale out by using multiple container instances and load-balancing to improve through put.

But one things is, multiple instances (ie. containers) of a “Service Type” are sharing the same database instance; and this could leave to performance bottle neck when multiple instance write/read on that database instance.

Traditionally, we would scale up on the processing power of that database instance to meet high demand.

The main questions for me is, what is the current best practice/design/solution to scale out/ horizontal scale so we can have multiple instance of that database and having performance improvement?

In particular, what I want to archive are:

  • One instance is down, a nother instance can handle the load -> High Availability
  • Can load balance read, or maybe even write to multiple database intance
  • Maintain the persistent and consistency of data incase I want to create more database-instance

Within my knowledge,

One of the solution is Microsoft SQL Server provide High availability for SQL Server containers with can do most of the requirements above ( But I’m wonder is there a better solution to avoid technology lock-down?

Another solution which I’m thinking of is: Replicate to multiple instance by using CDC Stream Data from a master database instance to multiple replications. This allow replication read.

But I’m still not convince because to quarrant the consistency, every services instance should write to master-database-instance, this could also, leave to bottle neck on master database instance.


Usually you need some form of database cluster, and you can think of replication or sharding. You should write to a master DB, and the other nodes just internally update their values. You also need to think about CAP theorem - whether you are willing to sacrifice consistency or availability knowing that network partitioning might (and will) happen?