Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can someone explain the difference between GCM and Google Pub/Sub

Google did answer the question here

https://cloud.google.com/pubsub/faq

But I'm still unclear on which scenarios would each be used for?

Is there something that pub sub can do which GCM can't?

like image 482
sameer54321 Avatar asked Jun 09 '16 18:06

sameer54321


People also ask

What is Google Pubsub used for?

Google Cloud Pub/Sub provides messaging between applications. Cloud Pub/Sub is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a "topic" and other applications can subscribe to that topic to receive the messages.

Is Google Pub/Sub same as Kafka?

In general, both are very solid Stream processing systems. The point which make the huge difference is that Pubsub is a cloud service attached to GCP whereas Apache Kafka can be used in both Cloud and On-prem. Update (April 6th 2021): Finally Kafka without Zookeeper.

Is Google Pub/Sub push or pull?

The Pub/Sub server sends each message as an HTTPS request to the subscriber client at a pre-configured endpoint. This request is shown as a PushRequest in the image.

What does GCM stand for Google?

Google Cloud Messaging (GCM) is a service that allows you to send push notifications from your server to your users' Android devices, and also to receive messages from devices on the same connection.


1 Answers

The primary difference between Google Cloud Pub/Sub and GCM is the points for scaling. GCM is designed to scale to many individual publishers and subscribers, on the order of end user devices such as phones. Cloud Pub/Sub, on the other hand, is designed to scale to very large throughput from/to fewer publishers and subscribers.

The two could actually be used together. Imagine, for example, you were building a stock market notification app where users get notifications when certain stocks reach certain prices. You set up a service that pulls stock prices from a variety of sources, processes them, and then publishes stock prices via Cloud Pub/Sub. You have a separate service that subscribes to Cloud Pub/Sub and gets these stock prices. It then determines which ones are of interest to which users of the app and uses GCM to send notifications to those interested.

Cloud Pub/Sub allows you to decouple your ingestion from different sources and your service that sends updates to users. Your services would be the publishers and subscribers to Cloud Pub/Sub with a large feed of data moving between them. The throughput on notification to individual users will be much smaller and you have a lot more subscribers, so GCM would be the proper system to use for that part.

like image 135
Kamal Aboul-Hosn Avatar answered Nov 15 '22 19:11

Kamal Aboul-Hosn