-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Milestone
Description
Files:
core/session/src/session_sender.rs—on_publish_message()core/session/src/producer_buffer.rs—push()
Problem:
In reliable-session mode, every outbound message triggers:
producer_buffer.push()—HashMap::insert(msg_id, slot).pending_acks.insert(msg_id, …)— another HashMap insert.ack_notifiers.insert(msg_id, oneshot_tx)— a third HashMap insert.- A per-message retransmission timer (
tokio::spawnof a timer task).
Three HashMap inserts + a spawned task per message is significant at high
rates.
Mitigation plan:
- Replace the three per-message HashMaps with a single indexed structure
(slab or ring buffer keyed bymsg_id % window). - Use a timer wheel (e.g.,
tokio_util::time::DelayQueue) instead of
spawning individual timer tasks. One task manages all pending timeouts. - Batch ACK processing: coalesce multiple ACKs before modifying data
structures.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status