Skip to content

Slow queries when hitting the cache #8681

Open
@cedvdb

Description

@cedvdb

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 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions