How Streaming API Event Usage is calculated?

Was going through the streaming Streaming API governor limit it is 10K events. How this is calculated? Is this is the number of events that the platform generates?

Well to verify this created a vf page and recorded all the events for all the push topics. But somehow the usage and event recorded is not matching. I am observing 80+ usage for every event recorded by vf page.

Any idea how they are calculated?

Answer

We had the exact same issue and it ultimately led to us bailing on the streaming API and using a very simple variable-frequency polling mechanism instead. In our case we were subscribing to the push topic in our VF pages on complete and unsubscribing on unload. I could actually see these unsubscribe calls completing successfully in a JavaScript debugger, but according to support the system was still charging us for an ever-growing set of subscribers. And that’s the key point…evidently you get charged for #events x #subscribers, not just #events.

Here’s the relevant extract from a Partner Portal support case that went on about this topic for a LONG time:

I have been working through this and was able to reproduce the behavior in an internal environment and came to the realization that the particular limit tracking appears to be: Matching DmlEvent X number of subscribers.

I have been assuming all along that the limit is in fact just the Matching DmlEvent event. The current behavior says the limit tracking is otherwise.

In your case, I believe that the probable reason for the increased multiplier even when just testing via the vf page, is that on refresh, close etc.. the unsubscribe code you have is not completing/running properly.

I will have to check with R&D on exactly how that limit is supposed to be tracked/calculated. From there, we should know exactly where to focus.

and then in the next exchange:

I received confirmation that the limit is calculated based on [Matching DmlEvent X number of subscribers].

So evidently the stream API limit “Maximum number of events per day (24–hour period)” is more accurately defined as “Maximum number of subscriber-directed events per day (24-hour period)”.

Attribution
Source : Link , Question Author : Avidev9 , Answer Author : Scott Wells

Leave a Comment