googleapis / googleapis/google-cloud-rust

More precise ack batch calculation for subscriber

Open
#5,236 1 comment 0 reactions 0 assignees View on GitHub
api: pubsub type: cleanup
Dominant language
Rust
Stars
955
Forks
144
Avg merge
1d 5h
Merged PRs (30d)
279

Description

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 length[^1]. 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.

[^1]: maybe a function of the subscription length?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.