Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
@firstname.lastname@example.org ref.update is very slow/unusable #2487
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When updating from @email@example.com to @firstname.lastname@example.org 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:
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.
@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):
I have two files (could be one) to reproduce the slowdowns.
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.