Skip to content

More precise ack batch calculation for subscriber #5236

@dbolduc

Description

@dbolduc

We assume some conservative upper limit on the number of ack IDs that fit in an AcknowledgeRequest and ModifyAckDeadlineRequest. It seems that ack IDs are of variable length1. As @feywind points out, it would be more precise to measure the size of the protobuf request as we fill it, and use that to determine when a batch is full.

We would probably modify our Leases class to keep track of the to_ack / to_nack size on Leases::add(). Gemini tells me we should add 3 + ack_id.len(), because the protobuf encoding for a string takes 3 bytes. We could cut off the request size at like 500 kB, and probably fill more ack IDs in a batch than we are doing now.

This might have a slight performance bump for very high throughput applications.

Footnotes

  1. maybe a function of the subscription length?

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: pubsubIssues related to the Pub/Sub API.type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions