Imagine the follow basic (abstract) setup:
1 API Gateway -> GWAY
2 Auth service (i.e. keycloak) -> AS
2 Location microservice(s) -> LMS
3 Activity microservice(s) -> AMS
Every microservice would have its own database and is subscribed to a topic to consume events of interest.
The LMS manages the user location read & write. Can only query details related to location. The AMS manages the activity but requires a fixed location for the activity.
In theory the LMS could send out a message to the topic with the userId and location AMS who is interested consumes the message and updates its own database.
Here comes the concern Database IO. Imagine multiple instances of each microservice and a thousand active users. The every single AMS would be constantly starting up write transactions from the consumed messages to update their own database.
In the end the end I imagine requests have a lot of processing time because of all the write locks on the database. Is there a way around this problem?
I've seen people mention using the gateway can be a solution? i.e. gateway queries 2 services in a single request or something.