0

Similar to Spring Data, can connection pooling be done on Firestore/CollectionReference. The quickstart shows steps to create connections for reading/writing, but could not locate if these Java objects support concurrency.

Not: referring Database Connection pool , not http pooling.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Raj
  • 747
  • 1
  • 9
  • 19
  • Hi @Raj, Are you pertaining to [HTTP connection pooling](https://cloud.google.com/functions/docs/samples/functions-tips-connection-pooling)? You can use HTTP connection pooling just include Firebase in your import statements. – Marc Anthony B Feb 28 '22 at 04:29
  • @marc-anthony-b , I am looking for https://en.wikipedia.org/wiki/Connection_pool , I edited question also slightly – Raj Mar 01 '22 at 01:24

1 Answers1

2

Connection pooling allows you to re-use objects that are expensive to create. The Firestore SDK already re-uses such objects behind the scenes, and there's neither a need nor a way to influence this.

The Firestore object itself is already cached by the SDK, or at least its expensive internals are. A CollectionReference object is lightweight wrapper for a path in the database, so it's cheap to create.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • thanks , https://docs.spring.io/spring-cloud-gcp/docs/current/reference/html/#autoconfiguration-3 mentions Spring Boot autoconfiguration creates the following bean ... an instance of Firestore from the Google Cloud Java Client for Firestore , so I suppose that bean is thread safe for concurrency and no connection pooling may be necessary, guessing .. – Raj Mar 04 '22 at 01:58
  • 1
    The Firestore SDK already re-uses objects that are expensive to create behind the scenes. But if you aren't certain, it should be fairly easy to measure that in your code. – Frank van Puffelen Mar 04 '22 at 02:02