[Firestore] Question: Recommendations for FirestoreClient / FirestoreDb lifecycle management for backend services
See original GitHub issueFollowing @jskeet suggestion I have created separate issue.
Hi, I’m using Google.Cloud.Firestore package in version 1.0.0-beta22. What are current recommendations for lifecycle management of FirestoreDb / FirestoreClient especially for backend services?
I use Firestore in backend service to process telemetry data (intensive reads and writes are done there). Service is deployed in GCP GKE and I observe high latency there. I followed all best practices but still 99th percentile is over 200ms (for reads and writes). Such results were present when I had single FirestoreDb instance for each pod.
I achieved lower latency by using basic pool mechanism. Created specified number of FirestoreDbs and then fetch them in random way. All these FirebaseDbs are created using the same json credentials:
var client = new FirestoreClientBuilder { JsonCredentials = credentialsJson }.Build();
return FirestoreDb.Create(projectName, client);
Are there any other recommendations for backend services to achieve lower latency?
Issue Analytics
- State:
- Created 4 years ago
- Comments:12
Thanks for the extra detail. I probably won’t investigate this any further for now, but that will be useful if we ever come across this again.
Best of luck with your application, and I hope Bigtable works out well for you.
Sorry for delay. We abandoned the idea of using Firestore in final solution, we have chosen to use Bigtable. Really appreciate your help and I think you have already answered my question.
I looked into the code which you have prepared and in comparision to ours there are few small differences.
batch.Set(documentRef, document);
batch.Create(documentRef, document);
Task WriteBatchAsync()
methodPlease remember that we observed differences when the pooling was turned on. Higher latency was observed when we used single firestoredb.