Reputation: 8377
Should a dynamic data be shared across microservices?
For instance there're 2 services: projects and documents. Each project can have documents and project members. Project members can access project documents. Is it ok to store project members in documents and update them each time a member is added/deleted from a project to perform access checks. Or is it better to query project members each time a user queries project documents?
Upvotes: 0
Views: 61
Reputation: 4002
Microservices approach is generally a tradeoff when it comes to data duplication . In my opinion data duplication isn't bad as long as it makes your service independent.
Take it this way if duplicating the small portion of data makes your service independent in a way that it can complete the operation even other service is down then go for it. e.g. booking and order are two separate services you can keep the status of order in booking service . even if the order service is not available your use can see the latest order status while query booking.
But if data duplication doesn't gives you independence then you have rethink the approach.
Upvotes: 1