Home > Enterprise >  Apache Pulsar vs Firebase Cloud Messaging for pub-sub
Apache Pulsar vs Firebase Cloud Messaging for pub-sub

Time:01-31

We have a system (yet to be released into production) which includes these components: Mobile app, back-end from cloud, back-end from multiple locations-on-prem servers.

Both types of back-ends (Python microservices) will be pushing messages to topics in a pubsub to which the mobile app (Typescript - React Native) will subscribe. Currently, we are using AWS IoT Core, but the management decided to move away from AWS.

Mobile app user volume will be in thousands at a time, in production. The message size could be of size: 2 KB maximum and the frequency of message pushed is like 5 to 10 messages in 20 minutes per mobile app.

Which of these 2 below options should we opt for this system?

  1. Apache Pulsar (Open-Source for DEV/STAGE & Streamnative.io's Pulsar-as-a-service for PROD) vs
  2. Firebase Cloud Messaging.

We are looking for either of those options that is highly scalable, lightweight, cheaper and faster. It must be easy to publish the messages from Python services and subscribe from Typescript.

CodePudding user response:

There is a third option to consider. Astra Streaming is DataStax's Apache Pulsar as a Service. See https://www.datastax.com/products/astra-streaming

CodePudding user response:

About FCM, as you can see here, you can sen messages with a payload of up to 4000 bytes.

In this document you can see different limits and quotas.

  1. Maximum message rate to a single device: For Android, you can send up to 240 messages/minute and 5,000 messages/hour to a single device.
  2. Topic message limit: The topic subscription add/remove rate is limited to 3,000 QPS per project.
  3. Fanout throttling

This is an example on how to build and send messages to topics using Python:

# The topic name can be optionally prefixed with "/topics/".
topic = 'highScores'

# See documentation on defining a message payload.
message = messaging.Message(
    data={
        'score': '850',
        'time': '2:45',
    },
    topic=topic,
)

# Send a message to the devices subscribed to the provided topic.
response = messaging.send(message)
# Response is a message ID string.
print('Successfully sent message:', response)cloud_messaging.py

I'm not familiar with Apache Pulsar but this could give you an idea of the capabilities of FCM and see if it covers your needs.

  • Related