-
Notifications
You must be signed in to change notification settings - Fork 9
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
Question: 'REPLICATE_ATTRIBUTES' for > 10.000 records #42
Comments
Hi @efrister this is the correct forum don't worry 😄 Yes you are right - the library fires off a bunch of writes in parallel. It seems that Firestore has a limit of max 10k writes/s per database. There are a few strategies I can think of to mitigate the issue:
What are your thoughts? |
Hey @anishkny, thanks for your reply! I was thinking along the lines of "1. Paginate affected documents"; that has worked well before when doing custom schema migrations to those collections - though retries will probably have to happen anyway to make sure failed attempts / rejections don't get dropped. What do you think? |
Addendum: just saw that apparently retries should work out of the box using the SDK: It might suffice to just chunk up the updates into batches of 500, and fire those off at the same time - if we're lucky, Firebase takes care of the rest, without having to explicitly retry or throttle. Definitely worth a try before bloating the code. |
So I like both your ideas. How about this: Short term - enhance Long term - in the spirit of not bloating WDYT? |
Sounds like a plan to me. I can take a stab at the PR until the end of this week and submit it as part of #43. |
@efrister coincidentally, I faced this same issue in another project (more than 500 writes/sec with consecutive keys) - I managed to address that using throttled-queue package. You could consider using that here too. |
Assigned you to this issue since GH wont let me assign you to #43. Closing the other one - lets use this one to track. Thanks! |
@anishkny I took a stab at implementing this feature here: However, I'm having the toughest time testing this and struggled to try this out on Firebase without pushing this to an npm repository. I think I'm misusing the firebase shell somehow; my integrify() hooks don't fire when I'm using it. |
Thanks for taking a shot! To test locally, you will need to setup a Firebase project, generate a service account JSON, calculate its base64 value and set env var To test deployed version, I think you can deploy |
Hi,
I hope this is the right "forum" for this question; if not, please feel free to point me to the correct one and I'll post this question there.
I need to replicate attributes from one collection to another collection; however, the number of records that are affected are > 10.000. I was having problems before with Firebase and lots of concurrent writes to the same collection. I was wondering if this library is addressing this problem; from reading the source, it seems all update queries are triggered in parallel.
Do you have any thoughts or plans for this?
The text was updated successfully, but these errors were encountered: