elgris / microservice-app-example

Example of polyglot microservice app
MIT License
1.39k stars 333 forks source link

Where to store the data? #10

Closed marvincaspar closed 6 years ago

marvincaspar commented 6 years ago

There are different ways to store the data but which one is the most recommended?

  1. Each api has it's own data storage.
  2. There is one database and all apis uses the same database.
elgris commented 6 years ago

@mc388 actually, it depends on a business case. I would avoid sharing a low-level datasource (like, direct access to a single SQL database) amongst APIs, because it creates cohesion. I would go for creating a datasource per API. But if service B needs access to a datasource of service A - create an endpoint in service A that gives away these data, do not provide direct low-level access to the service B.

elgris commented 6 years ago

discussion ticket, closing