Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Pub/Sub performance (latency under low load)?

We are about to pick Google Cloud Pub/Sub as our message bus. Some of the messages need to be dispatched in low latency durations like less than 100-200ms.

I read somewhere that in high volumes of messages, it performs well, but for lesser amounts like hundreds of messages per second, Pub/Sub may yield high latencies.

And in that previous question, the topic is not clear as well. what's google cloud pub/sub latency from 2016.

Are there any defined metrics about Pub/Sub latencies and relationship with the volume of messages?

like image 994
Erdem A Avatar asked Nov 07 '18 21:11

Erdem A


People also ask

What are the two main Pub/Sub latency metrics?

For Pub/Sub, the two most important latency metrics are: The amount of time it takes to acknowledge a published message. The amount of time it takes to deliver a published message to a subscriber.

What is the difference between pub Sub and Pub sub Lite?

Pub/Sub and Pub/Sub Lite are both horizontally scalable and managed messaging services. Pub/Sub is usually the default solution for most application integration and analytics use cases. Pub/Sub Lite is only recommended for applications where achieving extremely low cost justifies some additional operational work.

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.

What is Pub/Sub in Google?

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.


1 Answers

Cloud Pub/Sub was designed with high volumes of messages in mind, so it's expected for it to struggle sometimes if the message throughput is too low. This has to do with how Pub/Sub balances the pull requests between listeners.

Back to your question, there are no defined metrics regarding this behaviour, also not minimal latency or a magic number of messages that you can say it's considered "high load". In reality it depends on factors like the number of workers, batch size, processing time of each message, etc.

I've found this other StackOverflow answer that talks a bit more about a valid use case for Pub/Sub (messages in the order of thousands per second) and why high loads are recommended for Cloud Pub/Sub.

Edit:

Expanding on this topic, adding an asynchronous layer to the Pub/Sub implementation can help improve its performance, including latency in low message volume scenarios. Spotify, when working with Pub/Sub, realized the need for this and created their own Async Cloud Pub/Sub Client. They now recommend using Google's java client, but is worth taking this information into account

like image 53
Guillermo Cacheda Avatar answered Oct 04 '22 22:10

Guillermo Cacheda