--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/73cf1392-560a-436c-8bb7-ad5484bb2374%40googlegroups.com.
Hi Kane,Are we talking about Firestore or Realtime Database? Performance characteristics and thus the answer will vary significantly.☼, Kato
On Fri, May 1, 2020 at 4:10 PM Kane Kim <kane....@gmail.com> wrote:
It is unclear what is the root of this limitation, will it be different if subscriber is listening on group collection (across subcollections)?--
On Friday, May 1, 2020 at 10:26:37 AM UTC-7, Kane Kim wrote:Hello,
While browsing best practices I've found:
Limit the collection write rate
1,000 operations/secondKeep the rate of write operations for an individual collection under 1,000 operations/second.What does it mean? Does it imply we can't write to collection (utilizing all 10k write limit) while someone is listening on it?Do we have to shard collections now (this is very inconvenient).Thanks.
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/73cf1392-560a-436c-8bb7-ad5484bb2374%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/ced5921a-a603-4531-aba2-71b507ed1845%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/ced5921a-a603-4531-aba2-71b507ed1845%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/PWanrNOqimc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/c9d768fa-ec9a-49d1-8669-db9e44aa5885%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Firebase Google Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/firebase-talk/PWanrNOqimc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/e3110076-0263-475a-98d6-83d48844174b%40googlegroups.com.
The limitation that the 1000 writes/second guideline is dealing with applies to the collection as a whole. It doesn't matter whether listeners listen to the whole collection or not or whether their queries are overlapping.
It's hard to make a recommendation without knowing how you plan to use the timestamp in the room document. Another factor is how sensitive to latency you are for queries against the rooms collection. Another question to answer is whether or not approximate timestamps are acceptable.For example, if approximate timestamps are acceptable, then you could only update the timestamp in the room if it hasn't been updated in a while, or apply a rate limit
to such updates.
Alternatively, you could update the room timestamps in a Firebase Function and apply a rate limit/batching there.Depending on how you're using the timestamps, you might combine batching/rate limiting with a binning strategy wherein you put multiple room updates into a single document. If you're just using this as a trigger for clients to go and fetch updated messages, this might be an acceptable way to bring the write rate down.
Another option is to keep the timestamp in a subcollection of the room (and not keep a room document at all). This reduces the ability to query across rooms to find out which were updated last, but depending on your application it might be acceptable to just query the rooms of interest directly to see if they've changed.
A final option is to keep a timestamp per user rather than per room. You can store conversation updated timestamps along with other high velocity data in a separate collection per user. Doing this kind of fan out in a Function works particularly well and is the approach I'd probably take.
Finally note that if you're planning on indexing the timestamp (so as to be able to query for the most recently updated room) you're going to create a hotspot in your index and will run up against the 500 writes/second limit when indexed fields are consecutive or have similar values. This is really the principle problem to solve (though the mechanisms/discussion are the same).