What is the cost of setting up a changes subscription (use case explained)

34 views
Skip to first unread message

dylan bevan

unread,
Jan 20, 2018, 5:39:36 PM1/20/18
to RavenDB - 2nd generation document database
Hey folks,
I've been tinkering with using RavenDb as an event store. Because I'd be looking to plug it in to a legacy system which is currently a bit of a monolith, I need to do some funk.
I want to check for the presence of multiple documents (the events from the various services) and when they've all arrived combine them together and send them back to the caller (who's been nicely waiting for a http response all this time).
i.e.
1. A http post arrives to a web controller
2. the data is split in to multiple commands for different domains and written to each domain's RavenDb database
3. A RavenDb subscription on each domain picks up the command document, processes it and writes out events
4. The web controller set up a changes request to multiple databases for the presence of a document that meets certain criteria relating to the data it received (e.g. a unique tracking identifier)
5. Once all the results are in from the change observables (or the changes time out) the result JSON is created by combining the data from multiple sources together

My question is related to the cost of the changes API. If I have thousands of active users and the latency on the event processing could be up to 5 seconds (current threshold) is it OK to have a large number of transient change listeners on each database at the same time? If not then I'd write a subscriber (more durable) and push all matching events to a local cache with a ~10 second eviction policy.

Oren Eini (Ayende Rahien)

unread,
Jan 21, 2018, 2:35:37 AM1/21/18
to ravendb
There is typically a single Changes connection to the server per DocumentStore per database, with all the notifications going over that channel.
Thousands of such things should be fine, yes.
However, note that a Changes are advisory, not reliable. If there is a network hiccup and we need to re-establish the connection, you might lose notifications.



Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages