Delayed postprocessing refactor with new monitoring variables - #132
Closed
denizergonul wants to merge 14 commits into
Closed
Delayed postprocessing refactor with new monitoring variables#132denizergonul wants to merge 14 commits into
denizergonul wants to merge 14 commits into
Conversation
roland-sipos
requested changes
Mar 27, 2026
roland-sipos
left a comment
Member
There was a problem hiding this comment.
TLOG promotion and mutex on fast path.
denizergonul
marked this pull request as draft
March 27, 2026 13:05
This was referenced Apr 2, 2026
4 tasks
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
Delayed postprocessing algorithm is refactored because it was missing a critical consideration in timeout case. That is, timeout counts should be per item, a single count is not enough to represent all items' waiting times, which can vary.
4 new monitoring variables are added.
PS: These changes are meant for the next release. (Base branch will be changed to develop.)
datahandlinglibs dte/delayed_pp_monitoring
appmodel dte/delayedpp_attrs
daqsystemtest dte/delayedpp_attrs
snbmodules dte/delayedpp_attrs
ehn1-daqconfigs dte/delayedpp_attrs
Preliminary:
In the configuration, if
DataHandlerConf.post_processing_delay_ticks > 0, postprocessing will be delayed.This feature is introduced for data streams that may arrive out of order; such data is stored in sorted buffers.
Using this delay, we allow time for late data to arrive and be sorted so that it can still be processed in order.
If delay ticks is set, DHL spawns a dedicated thread pprocsched that runs the scheduler coroutine. The coroutine is woken up whenever data arrives.
In addition to delay ticks, one can also set
DataHandlerConf.post_processing_delay_max_wait > 0. This enables the timeout feature of delayed postprocessing. With this feature, the coroutine wakes up not only when data arrives, but also if no data arrives within the specified duration.One can also set
DataHandlerConf.post_processing_delay_min_waitto enforce a minimum wait time before the next processing iteration.Delayed postprocessing algorithm:
Return if buffer is empty.
Handle first cycle.
Return if postprocessing window is already closed.
A (postprocessing) window is a subset of the buffer which will be processed.
Next window start is where to start processing in the next iteration. If it is greater than the newest item in the buffer, it means that the window was already closed.
This happens if the entire buffer was already processed in a previous iteration and no newer data arrived since then.
e.g. Buffer: {1, 3}. We already processed {1, 3}. Now {2} arrives. We notice this because next window start is {4} (last processed + 1) and
4 > 3.In data arrival case, return if not enough time passed since last postprocessing.
Return if next window start cannot be found in the buffer. (Known issue with composite keys.)
Traverse the buffer and on the go:
6.1. In timeout case, update (add 1 to) the timeout count of the item.
6.2. Check if it is too early to process this item. If so, mark this point as window end and break the loop. (Window end will be the next window start.)
6.3. Otherwise, process the item and remove its timeout count entry.
Individual timeout count entries keep track of timeout counts of not-yet-processed items. This is required because not every item waits in the buffer the same amount of time. This number will be used to decide if this item can be processed.
An item can be processed if it is "old enough" relative to the newest timestamp. The age difference must be bigger than the delay ticks we configure; otherwise, it is too early to process. Timeouts artificially make items older; that is why, on top of the (real) age difference, we add the virtual age of the item.
Virtual age of an item is calculated by multiplying its timeout count by the max wait we configure.
Only in the timeout case, it is possible that the entire buffer was processed.
7.1. If so, the loop didn't break and window end wasn't set. Set window end to last processed + 1.
7.2. Otherwise, traverse the rest of the buffer to update the remaining timeout count s.
Make window end the next window start.
Addresses issue #116
Type of change
Testing checklist
dbt-build --unittest)pytest -s minimal_system_quick_test.py)dunedaq_integtest_bundle.sh)May need to also clone:
trigger,fdreadoutlibsandfdreadoutmodules.The following configuration parameters should be set for TP, TA and/or TC. Numbers can be different.
Example monitoring page
Further checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))