liangyepianzhou opened a new pull request, #25706:
URL: https://github.com/apache/pulsar/pull/25706

   ### Motivation
   
   Key_Shared is the **only** subscription type in Pulsar that enables parallel 
consumption while preserving per-key message ordering — the sole built-in 
answer to the "slow consumer + ordering" problem (see also the [related 
discussion](https://github.com/apache/pulsar/pull/25516#issuecomment-4285823743)).
   
   However, Key_Shared currently has a critical **production-readiness issue**: 
when even a single consumer stalls (e.g., downstream timeout), the stuck keys' 
messages flood the Replay queue and — through the `containsStickyKeyHash` 
ordering check — **starve all other healthy keys within minutes**. In the 
scenario analyzed in this PIP, a single consumer failure turns 500K msg/s 
real-time consumption into near-total starvation across all 200 partitions in 
under 3 minutes.
   
   **This is especially pressing in the AI era.** AI inference workloads 
increasingly rely on message queues as their async transport layer, yet 
inference is inherently slow (seconds per request) and demands strict per-key 
ordering. Key_Shared is the natural fit — but its current hot-key starvation 
problem makes it unsuitable for production AI pipelines.
   
   This PIP proposes the **Hot Key Overflow Mechanism**: when a small number of 
keys dominate the replay queue, their messages are diverted to an independent 
Overflow ManagedLedger. This unblocks Normal Read, allows mark-delete to 
advance, and maintains all guarantees (at-least-once, per-key ordering, client 
transparency).
   
   For full details — including the scenario analysis, mechanism design, entry 
format, write-then-ack protocol, hot-key detection strategy, and alternatives 
considered — please see the PIP document.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to