with-agents

Pub/Sub Made Easy

Cloud Pub/Sub Publishers - ep. 4

A ten-episode progression through topics, subscriptions, clients, endpoints, and replay

Ten 2019–2020 episodes follow a message from publication to independent subscription backlogs, delivery, acknowledgement, and replay. Examples compare push and pull consumers and connect them to serverless endpoints.

Google Cloud Tech 4 of 10
In this collection Browse 10 summaries 4 of 10

Pub/Sub publishers send messages to a topic. Priyanka explains how grouping messages into batches increases the rate of publication but makes individual messages wait, and how retry settings determine when a failed publish is abandoned.

Key points

  • Messages carry data and optional attributes: Attributes attach metadata to the payload, and a successful publication returns a server-generated message ID. An asynchronous API lets application code continue without waiting for the publish request to finish 00:00–02:06(opens in a new tab).
  • Batching trades latency for throughput: Client libraries can group messages by bytes, count, or elapsed time, but each message waits in memory for its batch to be sent 01:03–03:10(opens in a new tab).
  • Turning batching off minimizes latency, but small batches may be better: Priyanka recommends disabling batching to minimize latency, especially when an application publishes one message within a request-response sequence. The extra network and compute overhead of unbatched sends can still make small batches preferable, so each system needs tuning 02:06–03:10(opens in a new tab).
  • Retry settings control how long publication can take: The initial timer determines when retries begin, and the total timeout determines when the application gives up. Priyanka ties that choice to network availability, available memory, and application requirements 03:10–04:58(opens in a new tab).

Full video: https://www.youtube.com/watch?v=ML6P1ksHcqo(opens in a new tab)

Search

Search field guides and resources across the site.

    Keyboard shortcuts

    Press ? to open this guide (usually Shift + /). Close it before using other site shortcuts.

    Show keyboard shortcuts
    ?
    Search site
    Ctrl + K
    Close the current dialog or menu
    Esc

    Site shortcuts are ignored while typing. Browser and extension shortcuts may take priority.