Introduction
What is google pub sub?
Pub/Sub, a Google Cloud service designed for asynchronous messaging. It essentially acts as a "post office" that allows different software services to communicate without being directly connected.
Core Concept
In a Pub/Sub system, there are two main roles:
- Publishers: Send messages (events) to a "topic" without needing to know who will receive them.
- Subscribers: Listen to those topics to receive and process the messages.
Why Use It?
- Decoupling: Services don't need to wait for each other to finish a task, which makes the whole system more flexible and reliable.
- Scalability: It can handle massive amounts of data with very low latency (around 100 milliseconds).
- Parallelism: Unlike some other systems, it can "lease" individual messages to multiple workers at once, maximizing speed.
Common Use Cases
- Streaming Analytics: Ingesting user clicks or server logs to be analyzed in real-time by tools like Dataflow.
- Data Distribution: Syncing data across different databases or sharing business events across an entire company.
- Task Queues: Distributing heavy workloads (like resizing images or sending emails) among many worker services.
- IoT Integration: Streaming data from sensors or devices into a processing pipeline.