A cached filter, rewrite or client snapshot no longer reads the wall clock on every query #224

Closed
opened 2026-10-31 12:42:29 -04:00 by claude · 0 comments
Owner
  • Draft: BUG-2
  • Priority: medium (11.8 % of profile samples at Large after BP)
  • Agent: coder
  • Depends on: none
  • Decisions: none

Why

RefreshingSnapshot<T>.GetAsync calls timeProvider.GetUtcNow() on every read to check the TTL (src/dotnet/src/Ninlil.Dns.Server.Core/ClientIdentity/RefreshingSnapshot.cs:140). The filter and rewrite engines call it per query. In BP-12 these reads were 11.8 % of Full/Large throughput samples.

What changes

  • src/dotnet/src/Ninlil.Dns.Server.Core/ClientIdentity/RefreshingSnapshot.cs: store the load moment as a TimeProvider.GetTimestamp() value and compare with GetElapsedTime. That is a monotonic counter read with no DateTimeOffset build. Keep TimeProvider so ManualTimeProvider tests still drive it.
  • Lines 272 and 284 set the entry time the same way.
  • Behaviour must not change: same TTL, same refresh trigger.

Acceptance

  • The existing RefreshingSnapshot tests in src/dotnet/tests/Ninlil.Dns.Server.Core.Tests pass unchanged. A new test proves a stale entry still triggers a refresh when only the fake timestamp advances.
  • PipelineLatency and PipelineThroughput (--scale Large, --job default): before/after numbers in the PR, with no regression over 5 %.
  • Because Ninlil.Dns.Server.Core is a shared library, the whole solution passes (dotnet test Ninlil.slnx -p:NinlilSkipAngularBuild=true). Build has 0 warnings, csharpier is clean.
  • No schema, API or option change.

Source

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

- **Draft:** BUG-2 - **Priority:** medium (11.8 % of profile samples at Large after BP) - **Agent:** coder - **Depends on:** none - **Decisions:** none ### Why `RefreshingSnapshot<T>.GetAsync` calls `timeProvider.GetUtcNow()` on every read to check the TTL (`src/dotnet/src/Ninlil.Dns.Server.Core/ClientIdentity/RefreshingSnapshot.cs:140`). The filter and rewrite engines call it per query. In BP-12 these reads were 11.8 % of Full/Large throughput samples. ### What changes - `src/dotnet/src/Ninlil.Dns.Server.Core/ClientIdentity/RefreshingSnapshot.cs`: store the load moment as a `TimeProvider.GetTimestamp()` value and compare with `GetElapsedTime`. That is a monotonic counter read with no `DateTimeOffset` build. Keep `TimeProvider` so `ManualTimeProvider` tests still drive it. - Lines 272 and 284 set the entry time the same way. - Behaviour must not change: same TTL, same refresh trigger. ### Acceptance - [ ] The existing `RefreshingSnapshot` tests in `src/dotnet/tests/Ninlil.Dns.Server.Core.Tests` pass unchanged. A new test proves a stale entry still triggers a refresh when only the fake timestamp advances. - [ ] `PipelineLatency` and `PipelineThroughput` (`--scale Large`, `--job default`): before/after numbers in the PR, with no regression over 5 %. - [ ] Because `Ninlil.Dns.Server.Core` is a shared library, the whole solution passes (`dotnet test Ninlil.slnx -p:NinlilSkipAngularBuild=true`). Build has 0 warnings, csharpier is clean. - [ ] No schema, API or option change. ### Source `bp-design.md` "Items measured, not changed, still open" item 3; `bughunt-plan.md:543` item (1).
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#224
No description provided.