Last post Nov 03, 2019 12:41 PM by DA924
Oct 29, 2019 05:26 AM|Khuram.Shahzad|LINK
When do we really need micro services?
Does each micro service connect with its own database? if not then what about sociability and deadlock issue?
If each micro service have its own database then how to do transaction on databases?
Nov 01, 2019 05:31 PM|deepalgorithm|LINK
Microservices are meant to be small, modular, and independently deployable services. It's not a matter of need, but a matter of requirements and architectural preference. Regarding databases, quoting from an authoritative source:
"The service’s database is effectively part of the implementation of that service. It cannot be accessed directly by other services.
There are a few different ways to keep a service’s persistent data private. You do not need to provision a database server for each service. For example, if you are using a relational database then the options are:
Private-tables-per-service and schema-per-service have the lowest overhead. Using a schema per service is appealing since it makes ownership clearer. Some high throughput services might need their own database server.
It is a good idea to create barriers that enforce this modularity. You could, for example, assign a different database user id to each service and use a database access control mechanism such as grants. Without some kind of barrier to enforce encapsulation,
developers will always be tempted to bypass a service’s API and access it’s data directly."
Transactions are very tricky when you are dealing with microservices. A service’s transactions only involve its database and distributed transactions are avoided. However, there are patterns that can be employed if necessary such as SAGA, CQRS, and API Consumption.
I recommend you review the
link I provided. It goes over everything in detail.
Nov 03, 2019 12:41 PM|DA924|LINK
Maybe, the links will help you.