I'm working on a complex system that follows the principles of microservices, but with one exception - my services are more 'generalized' and big (I refer to them as macroservices
further down the post).
For example, instead of having very precise services:
- users
- news
- articles
- posts
- threads
- matches
- items
I have the following generalized services instead:
- portal (users, news, articles)
- forum (users (from portal), posts, threads)
- game (users (from portal), matches, items)
I understand that it affects scalability, flexibility and coupling - but this design choice has its reasons, and it's not the problem I'm facing either.
The problem
As you can see above - all of the macroservices
use users
resource originating from the portal
service.
Generally speaking, once you register on the portal - you can use the same account to play the game
or post on forums
.
Question:
Should I implement cross-service communication, so game
and forum
fetches user
from portal
when needed (quite often, as every post
, thread
and match
has user(s)
) - which means they can't function once portal
dies, but the data will always be up to date.
OR
Should I implement data duplication/replication, so whenever UserCreated, UserUpdated event fires - game
and forum
stores a duplicate of user
in their own database - which means they can still function if portal
dies, but there's a bit of coupling due to synchronization.
Portal.Users