Reputation: 17486
Today, Google Cloud does not support a single google cloud project to have Cloud Datastore run in both Native mode (Firestore mode) and Datastore mode. It says that the project owner must choose one.
For me, I want to use both Native mode & Datastore mode due to following reasons.
With Native mode, I will be able to utilize various frontend Firebase SDKs so that my app can directly communicate with Datastore without needing to go through custom backend, possibly saving latency and benefit from security policies in Firestore. Also, Firebase SDK does excellent job in online/offline caching in iOS/android environment, which can save a lot of work.
With Datastore mode, I will be able to build a scalable backend service which its write throughput to DB can exceed tens of thousands of tps. While Native mode can support around a million concurrent connections, it has 10,000 maximum writes per second limit at database level which I think can be low for a chat based and event based app that I am building.
If Native mode supported more than 10,000writes/s, I would happily choose Native mode and not worry about this, but that is not the case today.
So I started thinking about setting up 2 google cloud projects, 1 for native mode and 1 for datastore mode and use them together.
For instance, Project #1
will be used for Cloud Datastore in Native mode as well as Firebase Authentication, and pretty much every other products available in Firebase & Google Cloud.
Project #2
will be utilized only for Cloud Datastore in Datastore mode to support chat based, event based operations that will happen in my backend systems that can exceed 10,000/tps limit.
Other than possibly management overhead to maintain 2 projects, is there something that I need to worry about in this strategy? Or in general, is it common to have multiple google cloud projects to support one app/service?
e.g. Can systems running in Project #1's environment, such as [Cloud Run, App engine, GKE], be able to communicate with Project #2's Cloud Datastore?
e.g. Can systems running in Project #2's environment initialize server side Firebase SDK with Project #1's credential and authenticate Firebase auth tokens generated by frontend app using Project #1 Firebase SDK?
Upvotes: 1
Views: 410
Reputation: 42038
Yes, there are customers who have a single app split across multiple GCP projects for different reasons - multiple Datastore & Firestore databases is one of those.
Generally this works fine. The main gotcha to be aware of is the older App Engine SDKs don't allow you to specify project id, and hence cannot use a cross-project databases. The gcloud SDKs for Datastore and Firestore do not have this problem.
Upvotes: 1