[improve][pip] PIP-486: Scalable Topic Key-Shared Consumption#26077
Open
merlimat wants to merge 1 commit into
Open
[improve][pip] PIP-486: Scalable Topic Key-Shared Consumption#26077merlimat wants to merge 1 commit into
merlimat wants to merge 1 commit into
Conversation
Adds the PIP-486 design document: key-shared (per-message-key) ordered consumption on scalable topics via producer-side entry-bucketing, decoupling the producer's batching mode from the consumer's subscription mode. Discussion to follow on dev@pulsar.apache.org.
lhotari
reviewed
Jun 22, 2026
Comment on lines
+99
to
+101
| 2. **Intra-segment bucketing (this PIP).** A **separate, independent** hash `hashB(key)` maps keys onto | ||
| a second ring, and each segment divides *that* ring into `N` equal **buckets** — a bucket is a | ||
| contiguous `hashB` sub-range `[start, end)`. `hashB` must be independent of the segment-routing hash |
Member
There was a problem hiding this comment.
Rather than fixing the solution to equal-sized hash buckets, it would be useful to support splitting a hot shard on arbitrary boundaries based on key statistics. Message keys are often derived from business entities (tenant, account, or device IDs) whose traffic is heavily skewed—a handful of keys can dominate throughput while most contribute little. Equal-sized buckets can't isolate such hot keys, so adapting split boundaries to the observed distribution would balance load far more effectively. This wouldn't have to be implemented from the start, but it would be great if the design could be kept open for extension in this area.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PIP-468 and
PIP-483 give scalable topics a DAG of
range segments whose steady-state ordered-consumption model is one consumer per segment. Several
situations need key-shared (per-message-key) ordered consumption instead: draining a sealed-segment
backlog after a scale-up, consolidating many low-throughput topics, and getting consumer parallelism
beyond the max-segments ceiling.
Today, key-shared dispatch couples the producer's batching mode to the consumer's subscription mode
(the producer must disable batching or use the key-based batcher). This PIP removes that coupling for
scalable topics.
Modifications
Adds the design document
pip/pip-486.md. In summary:hashB, the low half of the same 32-bit keyhash whose high half drives segment routing) divides each segment into a configurable number of
buckets; the producer keeps each batch within one bucket and stamps the bucket's
hashBrange in theouter
MessageMetadata.per-key hashing, no decompression, one entry to exactly one consumer.
count is immutable per segment, changed only by a controller-driven "rebucket rollover" (a no-op
split reusing the PIP-468 seal/redirect flow).
Key_Sharedblocked-hash handling, tracking pending state per bucket. No shared-entry ack machinery.
This is a documentation-only PR (the design proposal). Implementation will follow in separate PRs.
A discussion thread will be started on dev@pulsar.apache.org.