google-cloud-php icon indicating copy to clipboard operation
google-cloud-php copied to clipboard

firestore documents retrieving very slow

Open mridulcs2012 opened this issue 4 years ago • 2 comments

Hi using this package https://github.com/kreait/laravel-firebase in laravel to fetch say 15,000 documents in a collection, the cloud-firestore component (https://github.com/googleapis/google-cloud-php-firestore) is installed and being used for the purpose. But why it's taking more than 40 seconds to fetch 15k documents right now?? to be clear i summarized this issue here in stackoverflow please help me asap

mridulcs2012 avatar Aug 25 '21 07:08 mridulcs2012

anyone plz??

mridulcs2012 avatar Sep 02 '21 05:09 mridulcs2012

I noticed when i use firease JS Sdk then it's faster. Are there any caching or other things in this php library and how can i overcome it?

mridulcs2012 avatar Sep 13 '21 04:09 mridulcs2012

Hi @mridulcs2012, this seems to be an issue with php grpc extension.

Over a collection (which extends from Query), there are 2 methods for getting the documents, listDocuments and documents.

listDocuments has some flags to increase the page size and make the calls faster (by reducing the number of calls) such as pageSize and resultLimit which fetches 20K documents in under 7 seconds. If you're using this function, consider using these flags.

documents method however supports no such flags. And I can reproduce the slow queries which seems to appear due to grpc extension.

vishwarajanand avatar May 26 '23 14:05 vishwarajanand

@mridulcs2012 I reported this issue to Grpc on your behalf and it will likely take sometime before we get to its root cause. I will close this issue now since there are no action items.

vishwarajanand avatar May 26 '23 15:05 vishwarajanand

We did the tests again and it seems it was a transient issue. All 20K documents were fetched in under <8 seconds.

vishwarajanand avatar Jun 20 '23 06:06 vishwarajanand