Search code examples
androidiosfirebasefirebase-cloud-messaging

Is there an expected latency band when sending a Firebase topic message and can it worsen when you have a larger number of subscribers to a topic?


We're currently using Firebase messaging to send a topic data message to all active users that are on a certain screen in our React Native application (both iOS and Android). We didn't have much noticeable latency when testing the behavior in a staging environment and were even using this in some of our lower traffic areas in the production environment with acceptably low latency (usually < 1 second, but never more than a couple seconds). Now we're trying to use this same feature for a heavier traffic use case (a few thousand concurrent active users) and are seeing some pretty heavy latency between sending the message and the end users actually receiving the message (at least a dozen seconds, sometimes well over a minute).

I know Firebase Topic messages "are optimized for throughput rather than latency" (from here), but I thought (perhaps mistakenly) that the couple seconds of latency we were seeing with the lower traffic use case was typical and not that it would increase with more active users. Is there any documentation anywhere describing what Firebase topic messages' expected latency bands are? We were trying to avoid the overhead required to keep track of all the users to send direct messages to ourselves, which is why we're sending the message to a topic instead.

A couple more thing about this use case:

  • The app on the user's device is active so this doesn't have anything to do with the app being backgrounded/inactive or receiving the message as a nottification.
  • The message being sent does not require any sort of security so that is not a concern for us with using topics.

Solution

  • FCM can vary from almost instant to up to an hour or more if the service is congested which is not project dependant. Some people have found suitable alternatives for near-instant messages in time-critical applications.

    Some popular alternatives: https://onesignal.com/, https://pushy.me/

    Note: OneSignal relies on FCM to deliver notifications on Android, so FCM may still throttle the notifications.