Skip to content
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

Slow queries when hitting the cache #8681

Open
cedvdb opened this issue Dec 15, 2024 · 1 comment
Open

Slow queries when hitting the cache #8681

cedvdb opened this issue Dec 15, 2024 · 1 comment

Comments

@cedvdb
Copy link

cedvdb commented Dec 15, 2024

Operating System

ubuntu

Environment (if applicable)

Version 131.0.6778.85 (Official Build) (64-bit)

Firebase SDK Version

10.11.1

Firebase SDK Product(s)

Firestore

Project Tooling

Flutter

Detailed Problem Description

I have a minimal reproduction sample (as much as I could) where a simple query hitting the cache takes a whopping 45 seconds to resolve.

During my trials to reproduce this issue I've found that:

  • The same query, when disableNetwork() is called before writing the data to Firestore takes an order of magnitude less time to resolve. After glancing over index_db, I see that the way data is stored is not the same when network is disabled, which could explain the effect on performances.
  • The same query also resolve normally when there is no flutter animation on the screen.

As I could not isolate the issue to any of those technologies (flutter & firestore), this leads me to believe there are performances issues in both firestore and flutter animation mechanism acting on each other. Furthermore the fact that the query is resolving in normally depending on how it has been written is indicative that there is an issue on the firestore side there.

Steps and code to reproduce issue

Prerequisite: Flutter is required to launch this

  1. Clone https://github.com/cedvdb/flutter_animation_perf/tree/circular_progress_indicator_firestore_perf_issue branch circular_progress_indicator_firestore_perf_issue
  2. Link a firebase project as described here https://firebase.google.com/docs/flutter/setup?platform=web
  3. Run the example app on the web
  4. Press create data button and wait until the text tells you to reload
  5. Reload the page
  6. Wait at least 2 minutes for the data to load

image

  • After that we are going to delete the local cache, by going in the chrome devtools > application > indexedDB > and then delete all firestore databases.
  • Close the application
  • switch to the branch network_disabled
  • relaunch the application
  • Press create data button and wait 30 seconds, then reload the page (the text will not change this time)
  • It now takes approximately 3 seconds to load the data from cache (still a lot but an order of magnitude less than before).

image

When removing the flutter animation it takes even less time:

image

@cedvdb cedvdb added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Dec 15, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: firestore needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants