-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🐛] [Android] Same query takes 58 seconds longer on Android #5941
Comments
What in the 😨 😅 First things first is to get current and make sure you are not overriding firebase-android-sdk, we want to make sure you are using up to date code here (14.0.0 right now) and up to date firebase-android-sdk (29.0.2 now) Frequently these things are fixed "before you get there" if you stay on the release train and keep current. I do issue major version semi-frequently but that's an abundance of caution - each one is usually a small, tiny thing and even the one about ios number formats should not actually break people as anyone actually relying on the old behavior of integer mis-formatting is really unexpected - https://invertase.io/blog/react-native-firebase-versioning Please let me know how that goes Second approach if up to date code works is to separate concerns - the biggest is: is it this wrapper? or the underlying SDK? The underlying SDK seems most likely since you say it works on iOS. That argues for a quickstart on the underlying SDK directly to focus effort: https://github.com/firebase/quickstart-android/tree/master/firestore |
We've verified that this still happens on react-native-firebase@14.0.0 and firebase-android-sdk@29.0.2. Will try the quickstart approach and see if the issue persists there. |
I noticed the same thing in my app. Loading times with several I just updated to the current versions, still the same: @OscarWoHA have you made any progress on this issue? |
@ptreitler Haven't had enough available resources to investigate this issue unfortunately. I do think this is something maintainer should try to investigate themselves as well though, due to the broad impact it might have. In regards to details about our tech stack feel free to contact me directly, I will happily elaborate - unfortunately posting it here would be outside of my scope. |
It's too project-specific in my opinion. We need a reproduction - https://stackoverflow.com/help/minimal-reproducible-example / https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh |
We were also having the same experience for as far as I can remember (at least a year). I was trying my latest attempt at debugging and I found that, as @mikehardy suggested, it was an issue with the underlying SDK. There are issues in flutterfire: 4305 and 6355. Also in firebase-android-sdk: 2637. The good news is that it has been fixed and has been released in firebase-android-sdk 24.0.2 Looks like latest react-native-firebase is on firebase sdk 29.1.0. Comparing 29.1.0 with the latest android sdk release shows that 29.1.0 is using firestore 24.0.1, one minor release before the 24.0.2, which contains the fix. In the meantime, I've add Hope this helps. |
Unfortunately the queries are still slow for me. Tried firebase-bom v29.2.1 and v29.3.0. I'm not sure if it's the same issue either, for me it doesn't just occur "after app returns to the foreground" as described in the issue tracker. |
Also experiencing this problem using react-native-firebase ( v14.7.0 ) , changed back to firebase ( v8.2.3 ) and query times went back down. From a query that takes 21s with the RNF, it took 9s with Firebase. |
@dev-andremonteiro interesting - I would be interested in knowing if the new offline / on-device indexing capabilities could help at all - Reason 2 here https://medium.com/firebase-developers/why-is-my-cloud-firestore-query-slow-e081fb8e55dd We do not yet expose this API (yet!), but you could crudely hack it in to the java files without too much trouble I think? (by which I mean: reach right in to node_modules/@react-native-firebase/firestore and just mash it in somewhere during init with a hard-coded string for the JSON on-device index you get from firebase-cli: https://github.com/firebase/firebase-android-sdk/blob/master/firebase-firestore/CHANGELOG.md#2410 Or if you try it and it is awesome I would be overjoyed to have a PR for it so it was formally supported :-) |
that version of firestore will only come in with the latest react-native-firebase though - fair warning - as otherwise there were problems with auth emulator connections in BoMs 29.2.x through 30.0.1, only with 30.0.1 was I comfortable doing a release that bumped the firebase-android-sdk bom |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Adding some findings from my project on Android.
With each firebase version update it seems that query response time is increasing. |
our implementation here has not changed structurally over that time with the exception of adding a configurable worker pool (you can read about it in the docs on rnfirebase.io for firebase.json inside the core/app package - you may configure more workers now, might help). The default remains the same though. I wonder if this relates to the underlying firebase-android-sdk then and you can reproduce perhaps with https://github.com/firebase/quickstart-android/tree/master/firestore |
Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions. |
Anyone got solution of this issue ?? |
This is happening with me as well. Response Times in android are quite large as compared to iOS. Any solution? |
my current understanding with this issue so far is that there has been a HUGE issue with rendering, navigating, and many other issues since React Native 0.71.x specifically harsh on Androids. I have tried pumping up performance limitations with firebase.json file, moving around service point countries (e.g. from hong kong to tokyo to seoul etc) but it seems like it's really about react native's problem for now. I'll come back after I try downgrading my react native version to 0.70.x and even 0.69.x if necessary and come back if any progress has been found. I'm leaving the issue I found from other repo : |
Here’s how I fixed the issue: Create a firebase.json file (or open it if it already exists) in the root folder of your project, and add the following configuration: After making this change, rebuild your app, and everything should work fine. |
Issue
We received feedback that a Firebase firestore query in our app was taking very long time to load on Android.
After investigating we figured out that using the traditional one-time
.get()
method on the query instead of.onSnapshot()
and instantly cancelling the listener has a huge difference in load time: TheonSnapshot()
promise takes 100 ms to resolve and theget()
promise upwards of 1 minute to resolve.What could cause this? This issue does not happen on iOS, so it is probably related to the Android SDK somehow.
I'll happily provide as much detail as possible to debug this - please do not hesitate to ask for more!
Query
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:Firebase
module(s) you're using that has the issue:Firestore
TypeScript
?Y
&4.2.4
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: