The literature about Microservices architecture often discourages to share a DB between two services due to tight coupling.
However in my case I have two applications that share the exact collections with the exact schemas with the only difference, that one of the apps is the backend (that creates the data) and the other app consumes the data but never writes the data.
My two possible setups would be
a) Shared DB
- Both apps share the same DB, two DB users exists
- The DB user of the consumer app has only read access
- The collections are shared by Meteor package as it is common code
- The consumer app uses
MongoInternals.RemoteCollectionDriver
to access the DB
b) DDP Connection
- Each app has its own DB and user with full access
- The consumer app connects using a
DDP
remote connection to the prover app - The provider app allows the consumer to call methods / publications
- To avoid massive publication-load the collections are synced in fixed intervals (which is for the UX of the consumer totally fine in my use case) using Methods
I am still struggling with both of the setups because both have their advantages and disadvantages and I still can’t see a clear “winner” here.
Maybe some of you can share some experience on this topic.