kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK

Home Page:https://github.com/kreait/firebase-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

firestore documents retrieving and parsing became very slow

mridulcs2012 opened this issue · comments

Hi using this package in laravel when i fetch say 15,000 documents in a collection then it takes more than 40 seconds why?? to be clear i summarized this issue here in stackoverflow please help me asap

Your original question is from February, and I and others already commented on Stack Overflow back then. This is an application design question, not a bug in the library. You yourself and others have already described why this takes so long (thousands of huge documents retrieved over the internet) and proposed approaches (limits and batch processing), so I don't understand why you expect a different answer here 😅.

By the way, I (and other open source maintainers as well) don't react well to "ASAP", especially since I don't work for you and you don't pay me 😅.

I am actually not sure if thousands of documents taking that long time to fetch. Someone mentioned using swift took 3/4 seconds faster when they retrieved 5k documents. So are there any drawbacks of php library? because i tested php script time and found that all that long time it taking to fetch from firestore only.

furthermore, i heard that firebase javascript sdk fetches data in 7/8 seconds in comparison with 40 seconds time taken by this php library. can anyone help me please where is the problem? do anyone know how can i disable cache in this php library so that i reduce fetching time?

There's no cache involved when fetching documents from Firestore (or in other components of the SDK), so, unfortunately, caching doesn't seem to be the issue here.

The Firestore component of the SDK is just™ a bridge to the google/cloud-firestore library (https://github.com/googleapis/google-cloud-php-firestore). If you want to ensure that the SDK is (not) the bottleneck, you could setting up the connection directly with the library and test if the requests are faster.

If they're not faster, I'd suggest opening an issue in their GitHub repository, perhaps someone can help.

The person that mentioned to you that swift was 3-4 seconds faster, did they fetch the same documents as you did? If yes, it could be that the iOS SDK has some mechanisms to make things faster (e.g. persistent connections). I can really just guess, but there are too many factors that could cause the slow operations, and, unfortunately, I'm not able to provide free support for this unless it's a bug directly in the code of this SDK, I hope you understand 🙏