Skip to content

Optimistic updates slow? #1225

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

Closed
scottmas opened this issue Jun 18, 2018 · 6 comments
Closed

Optimistic updates slow? #1225

scottmas opened this issue Jun 18, 2018 · 6 comments
Assignees
Labels
plugin: firestore Firebase Cloud Firestore Workflow: Waiting for User Response Blocked waiting for user response.

Comments

@scottmas
Copy link

Optimistic updates do not seem to work as fast expected in Firestore. It takes at minimum 200 ms for a snapshot listener to be triggered after the db is written to. I have offline persistence enabled for what that's worth, but the behavior is the same with or without internet connectivity.

Is there anything I am doing wrong or could do differently? I love the pattern of subscribing to snapshots from the data store and rendering the UI directly from it, then writing directly to the datastore and having my UI instantly update via the optimistic propagation. But the 200 ms lag makes this pattern problematic, so I may just have to have an intermediate caching layer, which I REALLY would like to avoid.

@Salakar
Copy link
Contributor

Salakar commented Aug 2, 2018

@scottmas it might be unrelated but could you try out the performance/threading changes I've pushed up for Cloud Firestore, see my comment: #1223 (comment)

It might be down to the above block thread issue delaying reads. I am assuming of course you meant Android as you've not mentioned any platforms or versions 😛


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar Salakar added question Workflow: Waiting for User Response Blocked waiting for user response. plugin: firestore Firebase Cloud Firestore labels Aug 2, 2018
@scottmas
Copy link
Author

scottmas commented Aug 2, 2018

I will try that out! However, the 150ms-200ms lag actually occurs on both ios and android. This is with a query that contains only 1 docChange, so it's highly unlikely to be the async issue you describe.

@Salakar Salakar added Workflow: Waiting for User Response Blocked waiting for user response. and removed Workflow: Waiting for User Response Blocked waiting for user response. labels Aug 2, 2018
@Salakar
Copy link
Contributor

Salakar commented Aug 2, 2018

@scottmas inclined to agree with you as well in that case.

Lets start with iOS; what version of the Firestore pod are you running?

There was a recent change on the ios-sdk that should have improved the performance of document querying on a collection; firebase/firebase-ios-sdk#1533 - I believe this landed in v5.4.1 of the Firestore ios pod. The change was also ported to the official JS SDK (firebase/firebase-js-sdk#1055) - unsure on Android as it's closed source.

@Salakar Salakar added Workflow: Waiting for User Response Blocked waiting for user response. and removed Workflow: Waiting for User Response Blocked waiting for user response. labels Aug 2, 2018
@Salakar Salakar self-assigned this Aug 2, 2018
@Ehesp
Copy link
Member

Ehesp commented Aug 19, 2018

Closing due to inactivity - please comment with a response to the above and we'll reopen.

@Ehesp Ehesp closed this as completed Aug 19, 2018
@jacklj
Copy link

jacklj commented Dec 17, 2019

I'm seeing the same thing (slow optimistic updates), and have seen it across a few projects / firebase versions. Is this a native firebase thing that can't be fixed? Thanks

@mikehardy
Copy link
Collaborator

Search the threads in the upstream repos - the firebase team is very responsive to queries there, especially if you can knock together a tiny reproduction repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: firestore Firebase Cloud Firestore Workflow: Waiting for User Response Blocked waiting for user response.
Projects
None yet
Development

No branches or pull requests

5 participants