docs(054): make the ready set part of the design - #273
Merged
Merged
Conversation
A second prototype round measured the outbound pull with the producer and the transport in separate tasks, as they run in a connector. Polling every open route then costs about 120 ns per idle route per message: 1,273 ns at 8 routes and 32,230 ns at 256, against about 470 ns for today's task per route. A ready set fed by per-route wakers stays flat at 590-630 ns with zero allocations, so it moves from an open question into §4.2. - §4.2: poll_stage takes routes from the ready set, oldest first; the ReadySet/RouteWake shape, wake ordering (register the task waker before reading the queue), requeue after a staged value, Ready(None) after the last closed route; measured cost. - §4.6: fairness is oldest-first over routes that woke. The outage change holds where the connector owns its send path; native MQTT still queues in rumqttc's request channel (sent all ten values before and after). - §5/§5.1: ready-set rows measured at 0 allocations; an informational scan-cost bench beside the gate; 5-run latency, live heap and outage results; the two-task wake-up table. - §7: polling every route recorded as the rejected previous revision. - §8: the many-routes question is resolved on the host; the ready set's cost on the STM32H5 rig and Embassy buffers stays open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXDnQEx2THUSTASYkThxCw
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.
Description
Design 054 as merged in #272 specifies that the connector's single transport task polls every outbound route on each wake-up. A per-route waker set (the "ready set") appeared only as an open question in §8. A second prototype round measured that design the way a connector actually runs it, with the producer and the transport in separate Tokio tasks. Polling every route then costs about 120 ns per idle route per message, which makes it slower than today's design almost immediately:
maintoday)Median of 5 runs. All three were measured on the same host and tree.
The ready set gives each route its own waker; waking it queues the route and wakes the transport task, so a wake-up only polls the routes that woke. It stays flat with zero allocations per message, parked or not, and passes the same 12 semantics tests as the scanning version: fairness, select safety, and no lost wake-up after a skipped value. This PR moves it into the design. The doc changes:
§4.2:
poll_stagetakes routes from the ready set, oldest first. The section gives theReadySet/RouteWakeshape and the ordering rules:Ready(None)after the last route closes.The measured cost replaces the old 80 ns-per-route figure, which came from a single-task loop that never parked.
§4.6: fairness is oldest-woken first. The outage behaviour change is limited to connectors that own their send path. Native MQTT still queues inside
rumqttc's request channel: in the outage test it sent all ten stale values both before and after this change, where the embedded backend now sends only the latest.§5 / §5.1:
§7: polling every route is recorded as the rejected previous revision.
§8: the "many routes" question is resolved on the host. The ready set's cost on the STM32H5 board and with Embassy's buffers stays open.
These changes keep the design consistent with the write-up on the costs and benefits of removing allocations, which uses AimDB as its worked example.
Related Issue
Checklist
make check). (Not run for this docs-only change.)🤖 Generated with Claude Code
https://claude.ai/code/session_01HXDnQEx2THUSTASYkThxCw
Generated by Claude Code