DB Read/Write Access vs. Remote DDP Connection

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.

Personally I’d say don’t over think it, if you have two entirely distinct apps that need different levels of access to the same db, then just share the same db. If the two apps only share a subset of the collections you could either move that subset to its own db, or have db users with collection level permission. We have a series of pure node apps that write data into our main db. We could have used a rest API or DDP to our app servers, but it’s much simpler and more reliable to allow them to access the few collections they require directly.