DPL: preparing for SlotArena migration - #15673
Open
ktf wants to merge 4 commits into
Open
Conversation
The existing sections assert part counts and pointer nullness, never payload contents, so any change to how a slot's messages are stored can shuffle them between inputs without a single test noticing. Stamp every payload and check it comes back on the right input, in the order it was relayed. Two arrangements that a shared per-slot buffer makes interesting: arrivals interleaved across three inputs, so a cell is no longer the last one written when its second part shows up; and an expiring input materialised into a slot the other inputs already occupy, which leaves the cells out of input order. Contents are also re-checked after the slot has been refilled, which pins that consuming really does hand the messages over.
A timing benchmark cannot tell a storage-layout regression from a busy machine. Count allocations instead: with eight inputs, relaying every input plus the consume costs 18 allocations, and that number must not grow when the way a slot holds its messages changes. The messages are built before the counter is armed, so what is measured is the relayer rather than fair::mq. The global operator new replacement only counts while a test arms it, so the rest of the binary is unaffected.
The relayer tests and benchmarks reach into the consumed record with .size() and .at(), which pins them to the record being a vector. Both operator[] and a count_inputs pipe work on anything the relayer might hand back -- a vector of per-input sets, or an arena holding them in one buffer -- so a change of storage leaves this code untouched instead of rewriting thirty call sites.
Every existing benchmark here uses one or two inputs, which is exactly the regime where per-input storage costs nothing to speak of, so none of them can see a change to how a slot holds its messages. Sweep 1/8/32/128 instead. Note this is the only benchmark using consumeWhenAll, which looks the TimesliceIndex up in the service registry (CompletionPolicyHelpers). The others use consumeWhenAny and never do, which is why BenchmarkServices does not register it and why it has to be registered here -- without it the benchmark throws at every input count, including one.
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.
Improve tests and benchmarks so that the upcoming migration from
vector<vector<Message>>toSlotArenais minimal and well covered.