Skip to content
Cloud Efficiency Hub

Unacknowledged Message Backlog in Abandoned Pub/Sub Subscriptions

The short version

Every Pub/Sub subscription attached to a topic keeps its own backlog of the messages published to that topic until they are acknowledged or expire.

PointFive Research

Cloud cost research at PointFive

GCP service
GCP Pub/Sub
Category
Other
Reference
CER-0492
Type
Idle or Unused Resource

Explanation

Why the waste happens and who it affects.

When a consumer is retired, broken or scaled too small, its subscription keeps receiving every new message, and unacknowledged messages older than one day start accruing message storage charges for as long as the subscription's retention duration allows.

Test consumers, replaced services, one-off debugging subscriptions and pipelines migrated elsewhere commonly leave a subscription behind. Pub/Sub deletes inactive subscriptions after 31 days by default, but subscriptions set to never expire, or kept alive by a client that connects without acknowledging, persist indefinitely. Retaining acknowledged messages and long-lived snapshots add further storage on top of the backlog.

Billing model

The pricing dimensions that drive this cost.

Pub/Sub bills throughput, data transfer and message storage.

Unacknowledged backlog storage
Charged per GiB-month for unacknowledged messages older than one day when the subscription's message retention duration is over one day, unless the topic already retains them
Retained acknowledged messages
Billed as message storage to the subscription's project when retain acknowledged messages is enabled
Snapshots
Billed for the messages they retain, plus a one-time fee equal to storing any existing backlog for seven days
Message retention duration
Defaults to 7 days for unacknowledged messages and can be set up to 31 days

How to detect

5 checks to find it in your estate.

  • Chart subscription/oldest_unacked_message_age_by_region and subscription/num_unacked_messages_by_region in Cloud Monitoring and flag subscriptions whose oldest unacknowledged message is consistently older than 24 hours
  • Cross-check activity with subscription/ack_message_count, subscription/pull_request_count and subscription/sent_message_count; a growing backlog with no acknowledgements means no working consumer
  • List subscriptions whose expiration policy is set to never expire and that have no identifiable owner or consumer
  • Find subscriptions with retain acknowledged messages enabled, and snapshots, that are not used for replay
  • Review the Pub/Sub message storage SKU in the Cloud Billing report by project to find where backlog storage is being billed

How to fix

6 ways to remove the waste.

  • Delete subscriptions that have no active consumer after confirming with the owner; deleting the subscription removes its backlog and its storage charges
  • Fix or scale consumers so messages are acknowledged within 24 hours, which keeps backlog out of billable storage
  • For subscriptions that do not need replay, set the message retention duration to 1 day or less; backlog storage is charged only when the subscription's retention duration is over 1 day
  • Where replay is the real requirement, use topic message retention instead of per-subscription retention; Google describes it as the least expensive storage mechanism because one copy serves all attached subscriptions
  • Keep the default 31-day expiration policy on subscriptions unless a documented reason requires never expire, so abandoned subscriptions are cleaned up automatically
  • Disable retain acknowledged messages and delete snapshots that are no longer needed

Documentation

Vendor references for pricing and configuration.