The query pipeline's worker hand-off is measured and its lock contention reduced if it pays #225

Open
opened 2026-10-31 12:42:29 -04:00 by claude · 0 comments
Owner
  • Draft: BUG-3
  • Priority: low (measure first; about 6 to 11 % of samples as Monitor.Enter_Slowpath)
  • Agent: coder
  • Depends on: none
  • Decisions: none

Why

Each worker takes a SemaphoreSlim slot, reads the channel and starts Task.Run per query (src/dotnet/src/Ninlil.Dns.Server.Core/Pipeline/DnsQueryProcessingPipeline.cs:277-307; the slot is created at :217). BP-12 showed Monitor.Enter_Slowpath at 11.4 % of samples, 54 % of it in this hand-off.

What changes

  • Profile PipelineThroughput at Large with 16 cores and name the contended lock (the semaphore, the bounded channel or the thread-pool queue).
  • Try at most two alternatives in DnsQueryProcessingPipeline.cs, keeping the MaxConcurrentQueries bound and the StopAsync drain rules. Examples: an Interlocked slot counter with a waiter queue, or a worker that runs the query inline when a slot is free.
  • Keep a change only if throughput improves by more than 10 % with --job default.

Acceptance

  • PR notes hold the profile, both measurements and the decision.
  • If code changes: the existing pipeline tests (MaxConcurrentQueries, drain on stop, hot reload of WorkerCount/ChannelCapacity) pass, and the whole solution passes (shared library).
  • No schema, API or option change.

Source

bp-design.md "Items measured, not changed, still open" item 4; bughunt-plan.md:543 item (2).

- **Draft:** BUG-3 - **Priority:** low (measure first; about 6 to 11 % of samples as `Monitor.Enter_Slowpath`) - **Agent:** coder - **Depends on:** none - **Decisions:** none ### Why Each worker takes a `SemaphoreSlim` slot, reads the channel and starts `Task.Run` per query (`src/dotnet/src/Ninlil.Dns.Server.Core/Pipeline/DnsQueryProcessingPipeline.cs:277-307`; the slot is created at `:217`). BP-12 showed `Monitor.Enter_Slowpath` at 11.4 % of samples, 54 % of it in this hand-off. ### What changes - Profile `PipelineThroughput` at Large with 16 cores and name the contended lock (the semaphore, the bounded channel or the thread-pool queue). - Try at most two alternatives in `DnsQueryProcessingPipeline.cs`, keeping the `MaxConcurrentQueries` bound and the `StopAsync` drain rules. Examples: an `Interlocked` slot counter with a waiter queue, or a worker that runs the query inline when a slot is free. - Keep a change only if throughput improves by more than 10 % with `--job default`. ### Acceptance - [ ] PR notes hold the profile, both measurements and the decision. - [ ] If code changes: the existing pipeline tests (`MaxConcurrentQueries`, drain on stop, hot reload of `WorkerCount`/`ChannelCapacity`) pass, and the whole solution passes (shared library). - [ ] No schema, API or option change. ### Source `bp-design.md` "Items measured, not changed, still open" item 4; `bughunt-plan.md:543` item (2).
claude added this to the (deleted) milestone 2026-10-31 12:42:29 -04:00
claude removed this from the (deleted) milestone 2026-11-06 12:28:39 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil#225
No description provided.