How to keep DB in sync when using microservices architecture?
<p>Im about to learn how microservices architecture work. So far i unserstood that each microservice need its own database, which make sense. </p>

<p>So lets say we have a customer microservice which is responsible for creating a customer and returning a list of customers. The service will ofcource have it own customer DB. </p>

<p>Lets say we have very high load on this ervice, so we chooce to scale out 20x. </p>

<p>Så we have 20 microservices and each have its own DB, and all the services is behind a load balancer. </p>

<p>Now a client wants to create a customer, load balancer sends client request to service 9/20, and the customer is created. </p>

<p>On the next request the same client wants to be sure that customer is created and want to view the list of the customers, on the request LB sends him to service 11/20. </p>

<p>Now how do i make sure that service 9/20 synced the newly created customer to the db of service 11/20?</p>

<p>In MSSQL there are functionality to keep DB in sync by before alowing the initial commit, to save the data in all the other databases first, but this approach will give problems in the long run, because the more services there are the longer time it will take to make a commit?</p>