-
Notifications
You must be signed in to change notification settings - Fork 893
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
@firebase/[email protected] ref.update is very slow/unusable #2487
Comments
@jmschae thanks for this, could I ask you to go a bit further and provide a working repro, with sample data and rules, we can run locally that shows the comparison? The code snippet is useful, but this is likely to be nuanced and hard to repro, so getting a complete mcve will be a necessary starting point. |
Hey, heres some reproducible code. I added a timer into the @firebase/app code to just console.log how long that loop takes. in 0.5.13 and above (this is 0.5.17 I believe):
in 0.5.12:
I have two files (could be one) to reproduce the slowdowns. index.js
fakeData.js:
the console log in 0.5.12 reliably logs 0ms times of duration for that loop, while 0.5.13 and above quickly slows down to a crawl on the scale of seconds. |
I'll look into it today. |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When updating from @firebase/[email protected] to @firebase/[email protected] updates became very slow. We operate in a relatively high write environment, and are streaming state updates into firebase. When upgrading from 0.5.12 to 0.5.13 we began seeing not just slow downs, but issues with ack'ing messages to pub/sub. We tracked this down to a change in the @firebase/database library, specifically commit 86971ea. A change occurred in src/core/Repo.ts that added:
this.serverSyncTree_.calcCompleteEventCache(path)
to the Repo.update function. This update changed the time it took this loop:
to complete from an average of 0ms to 750ms. This average of 750ms spans a range of about 5ms to upwards of 10,000ms. We believe this slowdown to be the cause of both our increase in observed update time, and our issues ack'ing message to pub/sub, since this piece of code seemingly never releases the event loop.
Steps to reproduce:
Write ~100 updates continuously as fast as you can, and track the time it takes to complete an update.
The text was updated successfully, but these errors were encountered: